Skip to content

Commit 8a9e722

Browse files
committed
fix: 🐛 error when moving funds with ticker
allows ticker to be used when calling Portfolio.moveFunds
1 parent 72748a6 commit 8a9e722

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "@polymeshassociation/polymesh-sdk",
33
"version": "0.0.0",
44
"description": "High-level API to interact with the Polymesh blockchain",
5-
"main": "dist/index.js",
65
"types": "dist/index.d.ts",
76
"author": "Polymesh Association",
87
"license": "ISC",

src/api/procedures/__tests__/moveFunds.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,12 @@ describe('moveFunds procedure', () => {
206206
const fromId = new BigNumber(1);
207207
const toId = new BigNumber(2);
208208
const did = 'someDid';
209-
const asset1 = entityMockUtils.getFungibleAssetInstance({ assetId: '0x1111' });
210-
const asset2 = entityMockUtils.getFungibleAssetInstance({ assetId: '0x2222' });
209+
const asset1 = entityMockUtils.getFungibleAssetInstance({
210+
assetId: '0x12341234123412341234123412341234',
211+
});
212+
const asset2 = entityMockUtils.getFungibleAssetInstance({
213+
assetId: '0x22341234123412341234123412341234',
214+
});
211215

212216
entityMockUtils.configureMocks({
213217
nftCollectionOptions: { exists: false },
@@ -357,7 +361,7 @@ describe('moveFunds procedure', () => {
357361
const fromId = new BigNumber(1);
358362
const toId = new BigNumber(2);
359363
const did = 'someDid';
360-
const assetId = 'TICKER';
364+
const assetId = '0x12341234123412341234123412341234';
361365

362366
entityMockUtils.configureMocks({
363367
fungibleAssetOptions: {
@@ -398,7 +402,7 @@ describe('moveFunds procedure', () => {
398402
const fromId = new BigNumber(1);
399403
const toId = new BigNumber(2);
400404
const did = 'someDid';
401-
const assetId = '0x7777';
405+
const assetId = '0x12341234123412341234123412341234';
402406

403407
entityMockUtils.configureMocks({
404408
fungibleAssetOptions: { exists: false },

src/api/procedures/moveFunds.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ async function segregateItems(
4747

4848
for (const item of items) {
4949
const { asset } = item;
50-
const assetId = await asAssetId(asset, context);
50+
const typedAsset = await asAsset(asset, context);
51+
const assetId = typedAsset.id;
5152
assetIds.push(assetId);
5253

53-
const typedAsset = await asAsset(asset, context);
5454
if (isFungibleAsset(typedAsset)) {
5555
if (!('amount' in item)) {
5656
throw new PolymeshError({

src/utils/internal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ export async function asAssetId(asset: string | BaseAsset, context: Context): Pr
10911091
return asset.id;
10921092
}
10931093

1094-
const base = await asBaseAsset(asUuid(asset), context);
1094+
const base = await asBaseAsset(asset, context);
10951095

10961096
return base.id;
10971097
}
@@ -1106,7 +1106,7 @@ export async function asAsset(asset: string | Asset, context: Context): Promise<
11061106
if (typeof asset !== 'string') {
11071107
assetId = asset.id;
11081108
} else {
1109-
assetId = asUuid(asset);
1109+
assetId = await asAssetId(asset, context);
11101110
}
11111111

11121112
const fungible = new FungibleAsset({ assetId }, context);

0 commit comments

Comments
 (0)