Skip to content

Commit

Permalink
Added to destination and source chains ss58Format and genesisHash (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elmar Kenigs authored Jan 24, 2023
1 parent bafd8b3 commit c2062f3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/config/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export interface Chain<ChainKeys extends ChainKey = ChainKey>
* unitsPerSecond = weightPerSecond * baseExtrinsicCost / baseExtrinsicWeight
*/
unitsPerSecond?: bigint;
ss58Format?: number;
genesisHash?: string;
}

export interface XcmFeeAsset<Symbols extends AssetSymbol = AssetSymbol> {
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/polkadot/PolkadotService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export class PolkadotService<
return {
decimals: this.#api.registry.chainDecimals.at(0) || 12,
symbol: this.#api.registry.chainTokens.at(0) as Symbols,
ss58Format: this.#api.registry.chainSS58 || 42,
genesisHash: this.#api.genesisHash.toHex(),
};
}

Expand Down
6 changes: 5 additions & 1 deletion packages/sdk/src/sdk/sdk.deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ export async function getDepositData<
},
native: { ...nativeAsset, decimals: meta.decimals },
origin,
source: config.source,
source: {
...config.source,
ss58Format: meta.ss58Format,
genesisHash: meta.genesisHash,
},
sourceBalance,
sourceFeeBalance: !isUndefined(sourceFeeBalance)
? { ...meta, balance: sourceFeeBalance }
Expand Down
6 changes: 5 additions & 1 deletion packages/sdk/src/sdk/sdk.withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ export async function getWithdrawData<

return {
asset: { ...asset, decimals },
destination: config.destination,
destination: {
...config.destination,
ss58Format: meta.ss58Format,
genesisHash: meta.genesisHash,
},
destinationBalance,
destinationFee,
existentialDeposit,
Expand Down

0 comments on commit c2062f3

Please sign in to comment.