-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ALL-4340 Add Stellar Testnet RPC (#1045)
- Loading branch information
Showing
10 changed files
with
254 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,178 @@ | ||
import { Network, Stellar, TatumSDK } from '../../../service' | ||
import process from 'process' | ||
import { ApiVersion, Network, Stellar, TatumSDK } from '../../../service' | ||
import { e2eUtil } from '../../e2e.util' | ||
|
||
const getStellarRpc = async () => | ||
const getStellarRpc = async (testnet?: boolean) => | ||
await TatumSDK.init<Stellar>({ | ||
network: Network.STELLAR, | ||
network: testnet ? Network.STELLAR_TESTNET : Network.STELLAR, | ||
verbose: e2eUtil.isVerbose, | ||
...(testnet && { apiKey: { v3: process.env.V3_API_KEY_TESTNET } }), | ||
...(!testnet && { apiKey: { v4: process.env.V4_API_KEY_MAINNET } }), | ||
version: testnet ? ApiVersion.V3 : ApiVersion.V4, | ||
}) | ||
|
||
describe('Stellar', () => { | ||
let tatum: Stellar | ||
|
||
beforeEach(async () => { | ||
tatum = await getStellarRpc() | ||
}) | ||
describe('mainnet', () => { | ||
beforeEach(async () => { | ||
tatum = await getStellarRpc(false) | ||
}) | ||
|
||
afterEach(async () => { | ||
await tatum.destroy() | ||
}) | ||
afterEach(async () => { | ||
await tatum.destroy() | ||
}) | ||
|
||
it('should get accounts', async () => { | ||
const response = await tatum.rpc.getAccounts({ | ||
asset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', | ||
it('should get accounts', async () => { | ||
const response = await tatum.rpc.getAccounts({ | ||
asset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('should get account detail', async () => { | ||
const response = await tatum.rpc.getAccount({ | ||
accountId: 'GA2224DCGO3WHC4EALA2PR2BZEMAYZPBPTHS243ZYYWQMBWRPJSZH5A6', | ||
it('should get account detail', async () => { | ||
const response = await tatum.rpc.getAccount({ | ||
accountId: 'GA2224DCGO3WHC4EALA2PR2BZEMAYZPBPTHS243ZYYWQMBWRPJSZH5A6', | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('should get fee stats', async () => { | ||
const response = await tatum.rpc.getFeeStats() | ||
expect(response).toBeDefined() | ||
}) | ||
it('should get fee stats', async () => { | ||
const response = await tatum.rpc.getFeeStats() | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('should get ledger', async () => { | ||
const response = await tatum.rpc.getLedger({ | ||
sequence: 49750265, | ||
it('should get ledger', async () => { | ||
const response = await tatum.rpc.getLedger({ | ||
sequence: 49750265, | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('should get offers', async () => { | ||
const response = await tatum.rpc.getOffers({}) | ||
expect(response).toBeDefined() | ||
}) | ||
it('should get offers', async () => { | ||
const response = await tatum.rpc.getOffers() | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
describe('should get strict send', () => { | ||
it('destinationAccount', async () => { | ||
const response = await tatum.rpc.getStrictSendPaymentPaths({ | ||
sourceAssetType: 'native', | ||
sourceAmount: '1', | ||
destinationAccount: 'GB3LIKQ6GOJ6D4EYKVS47L2SBY66SJO4MN4CZCMUPNBUJ2L3PF62ECBA', | ||
describe('should get strict send', () => { | ||
it('destinationAccount', async () => { | ||
const response = await tatum.rpc.getStrictSendPaymentPaths({ | ||
sourceAssetType: 'native', | ||
sourceAmount: '1', | ||
destinationAccount: 'GB3LIKQ6GOJ6D4EYKVS47L2SBY66SJO4MN4CZCMUPNBUJ2L3PF62ECBA', | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('destinationAssets', async () => { | ||
const response = await tatum.rpc.getStrictSendPaymentPaths({ | ||
sourceAssetType: 'native', | ||
sourceAmount: '1', | ||
sourceAssets: ['USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN'], | ||
destinationAssets: ['USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN'], | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('destinationAssets', async () => { | ||
const response = await tatum.rpc.getStrictSendPaymentPaths({ | ||
sourceAssetType: 'native', | ||
sourceAmount: '1', | ||
sourceAssets: ['USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN'], | ||
destinationAssets: ['USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN'], | ||
describe('should get strict receive', () => { | ||
it('sourceAssets', async () => { | ||
const response = await tatum.rpc.getStrictReceivePaymentPaths({ | ||
destinationAssetType: 'native', | ||
destinationAmount: '1', | ||
sourceAssets: ['USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN'], | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('sourceAccount', async () => { | ||
const response = await tatum.rpc.getStrictReceivePaymentPaths({ | ||
destinationAssetType: 'native', | ||
destinationAmount: '1', | ||
sourceAccount: 'GB3LIKQ6GOJ6D4EYKVS47L2SBY66SJO4MN4CZCMUPNBUJ2L3PF62ECBA', | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
}) | ||
|
||
describe('should get strict receive', () => { | ||
it('sourceAssets', async () => { | ||
const response = await tatum.rpc.getStrictReceivePaymentPaths({ | ||
destinationAssetType: 'native', | ||
destinationAmount: '1', | ||
sourceAssets: ['USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN'], | ||
describe('testnet', () => { | ||
beforeEach(async () => { | ||
tatum = await getStellarRpc(true) | ||
}) | ||
|
||
afterEach(async () => { | ||
await tatum.destroy() | ||
}) | ||
|
||
it('should get accounts', async () => { | ||
const response = await tatum.rpc.getAccounts({ | ||
asset: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('sourceAccount', async () => { | ||
const response = await tatum.rpc.getStrictReceivePaymentPaths({ | ||
destinationAssetType: 'native', | ||
destinationAmount: '1', | ||
sourceAccount: 'GB3LIKQ6GOJ6D4EYKVS47L2SBY66SJO4MN4CZCMUPNBUJ2L3PF62ECBA', | ||
it('should get account detail', async () => { | ||
const response = await tatum.rpc.getAccount({ | ||
accountId: 'GDNTXNPBK4YLQKBGPCZ5CAHUGQIXKKGSJAWQGO5XR73TQCAYSWQOCCFP', | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('should get fee stats', async () => { | ||
const response = await tatum.rpc.getFeeStats() | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('should get ledger', async () => { | ||
const response = await tatum.rpc.getLedgers() | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('should get offers', async () => { | ||
const response = await tatum.rpc.getOffers() | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
describe('should get strict send', () => { | ||
it('destinationAccount', async () => { | ||
const response = await tatum.rpc.getStrictSendPaymentPaths({ | ||
sourceAssetType: 'native', | ||
sourceAmount: '1', | ||
destinationAccount: 'GB3LIKQ6GOJ6D4EYKVS47L2SBY66SJO4MN4CZCMUPNBUJ2L3PF62ECBA', | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('destinationAssets', async () => { | ||
const response = await tatum.rpc.getStrictSendPaymentPaths({ | ||
sourceAssetType: 'native', | ||
sourceAmount: '1', | ||
sourceAssets: ['USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN'], | ||
destinationAssets: ['USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN'], | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
}) | ||
|
||
describe('should get strict receive', () => { | ||
it('sourceAssets', async () => { | ||
const response = await tatum.rpc.getStrictReceivePaymentPaths({ | ||
destinationAssetType: 'native', | ||
destinationAmount: '1', | ||
sourceAssets: ['USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN'], | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
|
||
it('sourceAccount', async () => { | ||
const response = await tatum.rpc.getStrictReceivePaymentPaths({ | ||
destinationAssetType: 'native', | ||
destinationAmount: '1', | ||
sourceAccount: 'GDNTXNPBK4YLQKBGPCZ5CAHUGQIXKKGSJAWQGO5XR73TQCAYSWQOCCFP', | ||
}) | ||
expect(response).toBeDefined() | ||
}) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.