Skip to content

Commit

Permalink
fix substrate calldata format (use inner)
Browse files Browse the repository at this point in the history
  • Loading branch information
nohaapav committed Dec 18, 2023
1 parent ef57c5d commit 3b5e675
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
16 changes: 9 additions & 7 deletions packages/sdk/test/route/bfs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ describe('Bfs graph', () => {
g.set(j, []);
}

g.get(0).push([2, 'bXjT2D2cuxUuP2JzddMxYusg4cKo3wENje5Xdk3jbNwtRvStq']);
g.get(0).push([1, 'bXn6KCrv8k2JV7B2c5jzLttBDqL4BurPCTcLa3NQk5SWDVXCJ']);
g.get(1).push([2, 'bXi1mHNp4jSRUNXuX3sY1fjCF9Um2EezkpzkFmQuLHaChdPM3']);
g.get(1).push([0, 'bXn6KCrv8k2JV7B2c5jzLttBDqL4BurPCTcLa3NQk5SWDVXCJ']);
g.get(2).push([0, 'bXjT2D2cuxUuP2JzddMxYusg4cKo3wENje5Xdk3jbNwtRvStq']);
g.get(2).push([1, 'bXi1mHNp4jSRUNXuX3sY1fjCF9Um2EezkpzkFmQuLHaChdPM3']);
g.get(0)!.push([2, 'bXjT2D2cuxUuP2JzddMxYusg4cKo3wENje5Xdk3jbNwtRvStq']);
g.get(0)!.push([1, 'bXn6KCrv8k2JV7B2c5jzLttBDqL4BurPCTcLa3NQk5SWDVXCJ']);
g.get(1)!.push([2, 'bXi1mHNp4jSRUNXuX3sY1fjCF9Um2EezkpzkFmQuLHaChdPM3']);
g.get(1)!.push([0, 'bXn6KCrv8k2JV7B2c5jzLttBDqL4BurPCTcLa3NQk5SWDVXCJ']);
g.get(2)!.push([0, 'bXjT2D2cuxUuP2JzddMxYusg4cKo3wENje5Xdk3jbNwtRvStq']);
g.get(2)!.push([1, 'bXi1mHNp4jSRUNXuX3sY1fjCF9Um2EezkpzkFmQuLHaChdPM3']);
});

it('Should find all possible paths from node 1 to node 2 with edge type', () => {
Expand Down Expand Up @@ -45,7 +45,9 @@ describe('Bfs graph created from node-edges', () => {
it('Should find all possible paths from node 1 to node 2 with edge type', () => {
const nodeEdges = getNodesAndEdges(stablePools);
const poolAssets = Object.keys(nodeEdges);
const possiblePairs: Edge[] = poolAssets.map((node) => nodeEdges[node]).flat();
const possiblePairs: Edge[] = poolAssets
.map((node) => nodeEdges[node])
.flat();
const graph = bfs.buildAndPopulateGraph(poolAssets, possiblePairs);
const result = bfs.findPaths(graph, 1, 2);
expect(result).toStrictEqual([
Expand Down
14 changes: 5 additions & 9 deletions packages/sdk/test/script/examples/router/getBestSpotPrice.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {ApiPromise} from '@polkadot/api';
import {ApiUrl, PolkadotExecutor} from '../../executor';
import {PoolService} from '../../../../src/pool';
import {TradeRouter} from '../../../../src/api';
import { ApiPromise } from '@polkadot/api';
import { ApiUrl, PolkadotExecutor } from '../../executor';
import { PoolService } from '../../../../src/pool';
import { TradeRouter } from '../../../../src/api';

class GetBestSpotPriceExample extends PolkadotExecutor {
async script(api: ApiPromise): Promise<any> {
Expand All @@ -11,8 +11,4 @@ class GetBestSpotPriceExample extends PolkadotExecutor {
}
}

new GetBestSpotPriceExample(
ApiUrl.HydraDx,
'Get best spot price',
true
).run();
new GetBestSpotPriceExample(ApiUrl.HydraDx, 'Get best spot price', true).run();
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class ExtrinsicTransfer implements TransferProvider<ExtrinsicConfig> {
calldata(config: ExtrinsicConfig): XCall {
const extrinic = this.#substrate.buildExtrinsic(config);
return {
data: extrinic.toHex(),
data: extrinic.inner.toHex(),
} as XCall;
}

Expand Down

0 comments on commit 3b5e675

Please sign in to comment.