-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
66 additions
and
56 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
27 changes: 27 additions & 0 deletions
27
packages/sdk/test/script/examples/router/withExternalAssets.ts
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ApiPromise } from '@polkadot/api'; | ||
import { ApiUrl, PolkadotExecutor } from '../../executor'; | ||
import { PoolService } from '../../../../src/pool'; | ||
import { TradeRouter } from '../../../../src/api'; | ||
|
||
class GetAllAssetsExample extends PolkadotExecutor { | ||
async script(api: ApiPromise): Promise<any> { | ||
const external = [ | ||
{ | ||
decimals: 8, | ||
id: '1000008', | ||
name: 'Danger Coin', | ||
symbol: 'DANGER', | ||
}, | ||
]; | ||
|
||
const poolService = new PoolService(api, { externalAssets: external }); | ||
const router = new TradeRouter(poolService); | ||
return router.getAllAssets(); | ||
} | ||
} | ||
|
||
new GetAllAssetsExample( | ||
ApiUrl.Nice, | ||
'Get all assets (external included)', | ||
true | ||
).run(); |