@talismn/sapi 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,4 +8,6 @@ export declare const getDecodedCall: (palletName: string, methodName: string, ar
8
8
  value: unknown;
9
9
  };
10
10
  };
11
- export declare const getDecodedCallFromPayload: <Res extends DecodedCall>(chain: Chain, payload: SignerPayloadJSON) => Res;
11
+ export declare const getDecodedCallFromPayload: <Res extends DecodedCall>(chain: Chain, payload: {
12
+ method: SignerPayloadJSON["method"];
13
+ }) => Res;
@@ -1,8 +1,6 @@
1
1
  import { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
2
- import { getDynamicBuilder, getLookupFn, UnifiedMetadata } from "@talismn/scale";
2
+ import { MetadataBuilder, MetadataLookup, UnifiedMetadata } from "@talismn/scale";
3
3
  import { SapiConnector } from "./getSapiConnector";
4
- export type ScaleBuilder = ReturnType<typeof getDynamicBuilder>;
5
- export type ScaleLookup = ReturnType<typeof getLookupFn>;
6
4
  export type Chain = {
7
5
  connector: SapiConnector;
8
6
  hexMetadata: `0x${string}`;
@@ -14,8 +12,9 @@ export type Chain = {
14
12
  signedExtensions?: ExtDef;
15
13
  registryTypes?: unknown;
16
14
  metadata: UnifiedMetadata;
17
- lookup: ScaleLookup;
18
- builder: ScaleBuilder;
15
+ lookup: MetadataLookup;
16
+ builder: MetadataBuilder;
17
+ metadataRpc: `0x${string}`;
19
18
  };
20
19
  export type ChainInfo = {
21
20
  specName: string;
@@ -1,5 +1,6 @@
1
1
  import { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
2
2
  import { SignerPayloadJSON } from "@polkadot/types/types";
3
+ import { Chain } from "./helpers/types";
3
4
  import { DecodedCall, PayloadSignerConfig, SapiConnectorProps } from "./types";
4
5
  export type ScaleApi = NonNullable<ReturnType<typeof getScaleApi>>;
5
6
  export declare const getScaleApi: (connector: SapiConnectorProps, hexMetadata: `0x${string}`, token: {
@@ -16,6 +17,7 @@ export declare const getScaleApi: (connector: SapiConnectorProps, hexMetadata: `
16
17
  symbol: string;
17
18
  decimals: number;
18
19
  };
20
+ chain: Chain;
19
21
  getConstant: <T>(pallet: string, constant: string) => T;
20
22
  getStorage: <T>(pallet: string, entry: string, keys: unknown[], at?: string) => Promise<T>;
21
23
  getDecodedCall: (pallet: string, method: string, args: unknown) => {
@@ -25,7 +27,9 @@ export declare const getScaleApi: (connector: SapiConnectorProps, hexMetadata: `
25
27
  value: unknown;
26
28
  };
27
29
  };
28
- getDecodedCallFromPayload: <Res extends DecodedCall>(payload: SignerPayloadJSON) => Res;
30
+ getDecodedCallFromPayload: <Res extends DecodedCall>(payload: {
31
+ method: SignerPayloadJSON["method"];
32
+ }) => Res;
29
33
  getExtrinsicPayload: (pallet: string, method: string, args: unknown, config: PayloadSignerConfig) => Promise<{
30
34
  payload: SignerPayloadJSON;
31
35
  txMetadata?: Uint8Array;
@@ -33,7 +37,7 @@ export declare const getScaleApi: (connector: SapiConnectorProps, hexMetadata: `
33
37
  getFeeEstimate: (payload: SignerPayloadJSON) => Promise<bigint>;
34
38
  getRuntimeCallValue: <T>(apiName: string, method: string, args: unknown[]) => Promise<T>;
35
39
  getTypeRegistry: (payload: SignerPayloadJSON) => import("@polkadot/types").TypeRegistry;
36
- submit: (payload: SignerPayloadJSON, signature?: `0x${string}`, txInfo?: any) => Promise<{
40
+ submit: (payload: SignerPayloadJSON, signature?: `0x${string}`, txInfo?: unknown) => Promise<{
37
41
  hash: `0x${string}`;
38
42
  }>;
39
43
  getCallDocs: (pallet: string, method: string) => string | null;
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var util = require('@polkadot/util');
4
3
  var scale = require('@talismn/scale');
5
4
  var anylogger = require('anylogger');
6
5
  var polkadotApi = require('polkadot-api');
7
6
  var metadataBuilders = require('@polkadot-api/metadata-builders');
8
7
  var utils = require('@polkadot-api/utils');
8
+ var util = require('@polkadot/util');
9
9
  var types = require('@polkadot/types');
10
10
  var merkleizeMetadata = require('@polkadot-api/merkleize-metadata');
11
11
  var substrateBindings = require('@polkadot-api/substrate-bindings');
@@ -431,7 +431,7 @@ function trailingZeroes(n) {
431
431
  return i;
432
432
  }
433
433
 
434
- const PERIOD = 64; // validity period in blocks, used for mortal era
434
+ const ERA_PERIOD = 64; // validity period in blocks, used for mortal era
435
435
 
436
436
  const getSignerPayloadJSON = async (chain, palletName, methodName, args, signerConfig, chainInfo) => {
437
437
  const {
@@ -442,13 +442,23 @@ const getSignerPayloadJSON = async (chain, palletName, methodName, args, signerC
442
442
 
443
443
  // on unstable networks with lots of forks (ex: westend asset hub as of june 2025),
444
444
  // using a finalized block as reference for mortality is necessary for txs to get through
445
- const blockHash = await getSendRequestResult(chain, "chain_getFinalizedHead", [], false);
446
- const [nonce, genesisHash, blockNumber] = await Promise.all([getSendRequestResult(chain, "system_accountNextIndex", [signerConfig.address], false), getStorageValue(chain, "System", "BlockHash", [0]), getStorageValue(chain, "System", "Number", [], blockHash)]);
445
+ let blockHash = await getSendRequestResult(chain, "chain_getFinalizedHead", [], false);
446
+ const [nonce, genesisHash, blockNumberFinalized, blockNumberCurrent] = await Promise.all([getSendRequestResult(chain, "system_accountNextIndex", [signerConfig.address], false), getStorageValue(chain, "System", "BlockHash", [0]), getStorageValue(chain, "System", "Number", [], blockHash), getStorageValue(chain, "System", "Number", [])]);
447
447
  if (!genesisHash) throw new Error("Genesis hash not found");
448
448
  if (!blockHash) throw new Error("Block hash not found");
449
+ let blockNumber = blockNumberFinalized;
450
+
451
+ // on Autonomys the finalized block hash is wrong (7000 blocks behind),
452
+ // if we use it to craft a tx it will be invalid
453
+ // => if finalized block number is more than 32 blocks behind, use current - 16
454
+ if (blockNumberCurrent - blockNumberFinalized > 32) {
455
+ blockNumber = blockNumberCurrent - 16;
456
+ const binBlockHash = await getStorageValue(chain, "System", "BlockHash", [blockNumber]);
457
+ blockHash = binBlockHash.asHex();
458
+ }
449
459
  const era = mortal({
450
- period: PERIOD,
451
- phase: blockNumber % PERIOD
460
+ period: ERA_PERIOD,
461
+ phase: blockNumber % ERA_PERIOD
452
462
  });
453
463
  const signedExtensions = chain.metadata.extrinsic.signedExtensions.map(ext => ext.identifier);
454
464
  const basePayload = {
@@ -485,10 +495,11 @@ const getSignerPayloadJSON = async (chain, palletName, methodName, args, signerC
485
495
  };
486
496
 
487
497
  const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signedExtensions, registryTypes) => {
488
- const metadata = scale.unifyMetadata(scale.decAnyMetadata(hexMetadata));
489
- util.assert(metadata, `Missing Metadata V14+ for chain ${connector.chainId}`);
490
- const lookup = scale.getLookupFn(metadata);
491
- const builder = scale.getDynamicBuilder(lookup);
498
+ const {
499
+ unifiedMetadata: metadata,
500
+ lookupFn: lookup,
501
+ builder
502
+ } = scale.parseMetadataRpc(hexMetadata);
492
503
  const chain = {
493
504
  connector: getSapiConnector(connector),
494
505
  hexMetadata,
@@ -498,7 +509,8 @@ const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signed
498
509
  registryTypes,
499
510
  metadata,
500
511
  lookup,
501
- builder
512
+ builder,
513
+ metadataRpc: hexMetadata
502
514
  };
503
515
  const chainInfo = getChainInfo(chain);
504
516
  const {
@@ -514,6 +526,7 @@ const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signed
514
526
  hasCheckMetadataHash,
515
527
  base58Prefix,
516
528
  token: chain.token,
529
+ chain,
517
530
  getConstant: (pallet, constant) => getConstantValue(chain, pallet, constant),
518
531
  getStorage: (pallet, entry, keys, at) => getStorageValue(chain, pallet, entry, keys, at),
519
532
  getDecodedCall: (pallet, method, args) => getDecodedCall(pallet, method, args),
@@ -522,8 +535,7 @@ const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signed
522
535
  getFeeEstimate: payload => getFeeEstimate(chain, payload, chainInfo),
523
536
  getRuntimeCallValue: (apiName, method, args) => getRuntimeCallResult(chain, apiName, method, args),
524
537
  getTypeRegistry: payload => getTypeRegistry(chain, payload),
525
- submit: (payload, signature, txInfo // eslint-disable-line @typescript-eslint/no-explicit-any
526
- ) => chain.connector.submit(payload, signature, txInfo),
538
+ submit: (payload, signature, txInfo) => chain.connector.submit(payload, signature, txInfo),
527
539
  getCallDocs: (pallet, method) => getCallDocs(chain, pallet, method),
528
540
  getDryRunCall: (from, decodedCall) => getDryRunCall(chain, from, decodedCall),
529
541
  isApiAvailable: (name, method) => isApiAvailable(chain, name, method)
@@ -553,7 +565,11 @@ const fetchBestMetadata = async (rpcSend, allowLegacyFallback) => {
553
565
  const message = cause?.message;
554
566
  if (allowLegacyFallback || message?.includes("is not found") ||
555
567
  // ex: crust standalone
556
- message?.includes("Module doesn't have export Metadata_metadata_versions") // ex: 3DPass
568
+ message?.includes("Module doesn't have export Metadata_metadata_versions") ||
569
+ // ex: 3DPass
570
+ message?.includes("Exported method Metadata_metadata_versions is not found") ||
571
+ // ex: sora-polkadot & sora-standalone
572
+ message?.includes("Execution, MethodNotFound, Metadata_metadata_versions") // ex: stafi
557
573
  ) {
558
574
  return await rpcSend("state_getMetadata", [], true);
559
575
  }
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var util = require('@polkadot/util');
4
3
  var scale = require('@talismn/scale');
5
4
  var anylogger = require('anylogger');
6
5
  var polkadotApi = require('polkadot-api');
7
6
  var metadataBuilders = require('@polkadot-api/metadata-builders');
8
7
  var utils = require('@polkadot-api/utils');
8
+ var util = require('@polkadot/util');
9
9
  var types = require('@polkadot/types');
10
10
  var merkleizeMetadata = require('@polkadot-api/merkleize-metadata');
11
11
  var substrateBindings = require('@polkadot-api/substrate-bindings');
@@ -431,7 +431,7 @@ function trailingZeroes(n) {
431
431
  return i;
432
432
  }
433
433
 
434
- const PERIOD = 64; // validity period in blocks, used for mortal era
434
+ const ERA_PERIOD = 64; // validity period in blocks, used for mortal era
435
435
 
436
436
  const getSignerPayloadJSON = async (chain, palletName, methodName, args, signerConfig, chainInfo) => {
437
437
  const {
@@ -442,13 +442,23 @@ const getSignerPayloadJSON = async (chain, palletName, methodName, args, signerC
442
442
 
443
443
  // on unstable networks with lots of forks (ex: westend asset hub as of june 2025),
444
444
  // using a finalized block as reference for mortality is necessary for txs to get through
445
- const blockHash = await getSendRequestResult(chain, "chain_getFinalizedHead", [], false);
446
- const [nonce, genesisHash, blockNumber] = await Promise.all([getSendRequestResult(chain, "system_accountNextIndex", [signerConfig.address], false), getStorageValue(chain, "System", "BlockHash", [0]), getStorageValue(chain, "System", "Number", [], blockHash)]);
445
+ let blockHash = await getSendRequestResult(chain, "chain_getFinalizedHead", [], false);
446
+ const [nonce, genesisHash, blockNumberFinalized, blockNumberCurrent] = await Promise.all([getSendRequestResult(chain, "system_accountNextIndex", [signerConfig.address], false), getStorageValue(chain, "System", "BlockHash", [0]), getStorageValue(chain, "System", "Number", [], blockHash), getStorageValue(chain, "System", "Number", [])]);
447
447
  if (!genesisHash) throw new Error("Genesis hash not found");
448
448
  if (!blockHash) throw new Error("Block hash not found");
449
+ let blockNumber = blockNumberFinalized;
450
+
451
+ // on Autonomys the finalized block hash is wrong (7000 blocks behind),
452
+ // if we use it to craft a tx it will be invalid
453
+ // => if finalized block number is more than 32 blocks behind, use current - 16
454
+ if (blockNumberCurrent - blockNumberFinalized > 32) {
455
+ blockNumber = blockNumberCurrent - 16;
456
+ const binBlockHash = await getStorageValue(chain, "System", "BlockHash", [blockNumber]);
457
+ blockHash = binBlockHash.asHex();
458
+ }
449
459
  const era = mortal({
450
- period: PERIOD,
451
- phase: blockNumber % PERIOD
460
+ period: ERA_PERIOD,
461
+ phase: blockNumber % ERA_PERIOD
452
462
  });
453
463
  const signedExtensions = chain.metadata.extrinsic.signedExtensions.map(ext => ext.identifier);
454
464
  const basePayload = {
@@ -485,10 +495,11 @@ const getSignerPayloadJSON = async (chain, palletName, methodName, args, signerC
485
495
  };
486
496
 
487
497
  const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signedExtensions, registryTypes) => {
488
- const metadata = scale.unifyMetadata(scale.decAnyMetadata(hexMetadata));
489
- util.assert(metadata, `Missing Metadata V14+ for chain ${connector.chainId}`);
490
- const lookup = scale.getLookupFn(metadata);
491
- const builder = scale.getDynamicBuilder(lookup);
498
+ const {
499
+ unifiedMetadata: metadata,
500
+ lookupFn: lookup,
501
+ builder
502
+ } = scale.parseMetadataRpc(hexMetadata);
492
503
  const chain = {
493
504
  connector: getSapiConnector(connector),
494
505
  hexMetadata,
@@ -498,7 +509,8 @@ const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signed
498
509
  registryTypes,
499
510
  metadata,
500
511
  lookup,
501
- builder
512
+ builder,
513
+ metadataRpc: hexMetadata
502
514
  };
503
515
  const chainInfo = getChainInfo(chain);
504
516
  const {
@@ -514,6 +526,7 @@ const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signed
514
526
  hasCheckMetadataHash,
515
527
  base58Prefix,
516
528
  token: chain.token,
529
+ chain,
517
530
  getConstant: (pallet, constant) => getConstantValue(chain, pallet, constant),
518
531
  getStorage: (pallet, entry, keys, at) => getStorageValue(chain, pallet, entry, keys, at),
519
532
  getDecodedCall: (pallet, method, args) => getDecodedCall(pallet, method, args),
@@ -522,8 +535,7 @@ const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signed
522
535
  getFeeEstimate: payload => getFeeEstimate(chain, payload, chainInfo),
523
536
  getRuntimeCallValue: (apiName, method, args) => getRuntimeCallResult(chain, apiName, method, args),
524
537
  getTypeRegistry: payload => getTypeRegistry(chain, payload),
525
- submit: (payload, signature, txInfo // eslint-disable-line @typescript-eslint/no-explicit-any
526
- ) => chain.connector.submit(payload, signature, txInfo),
538
+ submit: (payload, signature, txInfo) => chain.connector.submit(payload, signature, txInfo),
527
539
  getCallDocs: (pallet, method) => getCallDocs(chain, pallet, method),
528
540
  getDryRunCall: (from, decodedCall) => getDryRunCall(chain, from, decodedCall),
529
541
  isApiAvailable: (name, method) => isApiAvailable(chain, name, method)
@@ -553,7 +565,11 @@ const fetchBestMetadata = async (rpcSend, allowLegacyFallback) => {
553
565
  const message = cause?.message;
554
566
  if (allowLegacyFallback || message?.includes("is not found") ||
555
567
  // ex: crust standalone
556
- message?.includes("Module doesn't have export Metadata_metadata_versions") // ex: 3DPass
568
+ message?.includes("Module doesn't have export Metadata_metadata_versions") ||
569
+ // ex: 3DPass
570
+ message?.includes("Exported method Metadata_metadata_versions is not found") ||
571
+ // ex: sora-polkadot & sora-standalone
572
+ message?.includes("Execution, MethodNotFound, Metadata_metadata_versions") // ex: stafi
557
573
  ) {
558
574
  return await rpcSend("state_getMetadata", [], true);
559
575
  }
@@ -1,9 +1,9 @@
1
- import { assert, u8aConcatStrict } from '@polkadot/util';
2
- import { unifyMetadata, decAnyMetadata, getLookupFn as getLookupFn$1, getDynamicBuilder } from '@talismn/scale';
1
+ import { parseMetadataRpc } from '@talismn/scale';
3
2
  import anylogger from 'anylogger';
4
3
  import { Enum, Binary } from 'polkadot-api';
5
4
  import { getLookupFn } from '@polkadot-api/metadata-builders';
6
5
  import { toHex, mergeUint8 } from '@polkadot-api/utils';
6
+ import { assert, u8aConcatStrict } from '@polkadot/util';
7
7
  import { TypeRegistry, Metadata } from '@polkadot/types';
8
8
  import { merkleizeMetadata } from '@polkadot-api/merkleize-metadata';
9
9
  import { enhanceEncoder, Bytes, u16 } from '@polkadot-api/substrate-bindings';
@@ -425,7 +425,7 @@ function trailingZeroes(n) {
425
425
  return i;
426
426
  }
427
427
 
428
- const PERIOD = 64; // validity period in blocks, used for mortal era
428
+ const ERA_PERIOD = 64; // validity period in blocks, used for mortal era
429
429
 
430
430
  const getSignerPayloadJSON = async (chain, palletName, methodName, args, signerConfig, chainInfo) => {
431
431
  const {
@@ -436,13 +436,23 @@ const getSignerPayloadJSON = async (chain, palletName, methodName, args, signerC
436
436
 
437
437
  // on unstable networks with lots of forks (ex: westend asset hub as of june 2025),
438
438
  // using a finalized block as reference for mortality is necessary for txs to get through
439
- const blockHash = await getSendRequestResult(chain, "chain_getFinalizedHead", [], false);
440
- const [nonce, genesisHash, blockNumber] = await Promise.all([getSendRequestResult(chain, "system_accountNextIndex", [signerConfig.address], false), getStorageValue(chain, "System", "BlockHash", [0]), getStorageValue(chain, "System", "Number", [], blockHash)]);
439
+ let blockHash = await getSendRequestResult(chain, "chain_getFinalizedHead", [], false);
440
+ const [nonce, genesisHash, blockNumberFinalized, blockNumberCurrent] = await Promise.all([getSendRequestResult(chain, "system_accountNextIndex", [signerConfig.address], false), getStorageValue(chain, "System", "BlockHash", [0]), getStorageValue(chain, "System", "Number", [], blockHash), getStorageValue(chain, "System", "Number", [])]);
441
441
  if (!genesisHash) throw new Error("Genesis hash not found");
442
442
  if (!blockHash) throw new Error("Block hash not found");
443
+ let blockNumber = blockNumberFinalized;
444
+
445
+ // on Autonomys the finalized block hash is wrong (7000 blocks behind),
446
+ // if we use it to craft a tx it will be invalid
447
+ // => if finalized block number is more than 32 blocks behind, use current - 16
448
+ if (blockNumberCurrent - blockNumberFinalized > 32) {
449
+ blockNumber = blockNumberCurrent - 16;
450
+ const binBlockHash = await getStorageValue(chain, "System", "BlockHash", [blockNumber]);
451
+ blockHash = binBlockHash.asHex();
452
+ }
443
453
  const era = mortal({
444
- period: PERIOD,
445
- phase: blockNumber % PERIOD
454
+ period: ERA_PERIOD,
455
+ phase: blockNumber % ERA_PERIOD
446
456
  });
447
457
  const signedExtensions = chain.metadata.extrinsic.signedExtensions.map(ext => ext.identifier);
448
458
  const basePayload = {
@@ -479,10 +489,11 @@ const getSignerPayloadJSON = async (chain, palletName, methodName, args, signerC
479
489
  };
480
490
 
481
491
  const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signedExtensions, registryTypes) => {
482
- const metadata = unifyMetadata(decAnyMetadata(hexMetadata));
483
- assert(metadata, `Missing Metadata V14+ for chain ${connector.chainId}`);
484
- const lookup = getLookupFn$1(metadata);
485
- const builder = getDynamicBuilder(lookup);
492
+ const {
493
+ unifiedMetadata: metadata,
494
+ lookupFn: lookup,
495
+ builder
496
+ } = parseMetadataRpc(hexMetadata);
486
497
  const chain = {
487
498
  connector: getSapiConnector(connector),
488
499
  hexMetadata,
@@ -492,7 +503,8 @@ const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signed
492
503
  registryTypes,
493
504
  metadata,
494
505
  lookup,
495
- builder
506
+ builder,
507
+ metadataRpc: hexMetadata
496
508
  };
497
509
  const chainInfo = getChainInfo(chain);
498
510
  const {
@@ -508,6 +520,7 @@ const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signed
508
520
  hasCheckMetadataHash,
509
521
  base58Prefix,
510
522
  token: chain.token,
523
+ chain,
511
524
  getConstant: (pallet, constant) => getConstantValue(chain, pallet, constant),
512
525
  getStorage: (pallet, entry, keys, at) => getStorageValue(chain, pallet, entry, keys, at),
513
526
  getDecodedCall: (pallet, method, args) => getDecodedCall(pallet, method, args),
@@ -516,8 +529,7 @@ const getScaleApi = (connector, hexMetadata, token, hasCheckMetadataHash, signed
516
529
  getFeeEstimate: payload => getFeeEstimate(chain, payload, chainInfo),
517
530
  getRuntimeCallValue: (apiName, method, args) => getRuntimeCallResult(chain, apiName, method, args),
518
531
  getTypeRegistry: payload => getTypeRegistry(chain, payload),
519
- submit: (payload, signature, txInfo // eslint-disable-line @typescript-eslint/no-explicit-any
520
- ) => chain.connector.submit(payload, signature, txInfo),
532
+ submit: (payload, signature, txInfo) => chain.connector.submit(payload, signature, txInfo),
521
533
  getCallDocs: (pallet, method) => getCallDocs(chain, pallet, method),
522
534
  getDryRunCall: (from, decodedCall) => getDryRunCall(chain, from, decodedCall),
523
535
  isApiAvailable: (name, method) => isApiAvailable(chain, name, method)
@@ -547,7 +559,11 @@ const fetchBestMetadata = async (rpcSend, allowLegacyFallback) => {
547
559
  const message = cause?.message;
548
560
  if (allowLegacyFallback || message?.includes("is not found") ||
549
561
  // ex: crust standalone
550
- message?.includes("Module doesn't have export Metadata_metadata_versions") // ex: 3DPass
562
+ message?.includes("Module doesn't have export Metadata_metadata_versions") ||
563
+ // ex: 3DPass
564
+ message?.includes("Exported method Metadata_metadata_versions is not found") ||
565
+ // ex: sora-polkadot & sora-standalone
566
+ message?.includes("Execution, MethodNotFound, Metadata_metadata_versions") // ex: stafi
551
567
  ) {
552
568
  return await rpcSend("state_getMetadata", [], true);
553
569
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/sapi",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "GPL-3.0-or-later",
@@ -31,7 +31,7 @@
31
31
  "anylogger": "^1.0.11",
32
32
  "polkadot-api": "1.13.1",
33
33
  "scale-ts": "^1.6.1",
34
- "@talismn/scale": "0.1.2"
34
+ "@talismn/scale": "0.2.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/jest": "^29.5.14",