@kynesyslabs/demosdk 1.6.0 → 1.6.2

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.
Files changed (28) hide show
  1. package/build/abstraction/CoinFinder.d.ts +1 -1
  2. package/build/abstraction/CoinFinder.js +10 -7
  3. package/build/abstraction/CoinFinder.js.map +1 -1
  4. package/build/abstraction/EvmCoinFinder.d.ts +2 -1
  5. package/build/abstraction/EvmCoinFinder.js +11 -3
  6. package/build/abstraction/EvmCoinFinder.js.map +1 -1
  7. package/build/abstraction/Identities.d.ts +32 -0
  8. package/build/abstraction/Identities.js +18 -0
  9. package/build/abstraction/Identities.js.map +1 -0
  10. package/build/abstraction/index.d.ts +3 -1
  11. package/build/abstraction/index.js +3 -1
  12. package/build/abstraction/index.js.map +1 -1
  13. package/build/abstraction/providers/AbstractionProviders.d.ts +39 -0
  14. package/build/abstraction/providers/AbstractionProviders.js +67 -0
  15. package/build/abstraction/providers/AbstractionProviders.js.map +1 -0
  16. package/build/abstraction/providers/CoinAddresses.d.ts +25 -0
  17. package/build/abstraction/providers/CoinAddresses.js +32 -0
  18. package/build/abstraction/providers/CoinAddresses.js.map +1 -0
  19. package/build/abstraction/providers/Providers.d.ts +6 -32
  20. package/build/abstraction/providers/Providers.js +10 -62
  21. package/build/abstraction/providers/Providers.js.map +1 -1
  22. package/build/abstraction/providers/ankr.d.ts +1 -1
  23. package/build/abstraction/providers/ankr.js +24 -19
  24. package/build/abstraction/providers/ankr.js.map +1 -1
  25. package/build/abstraction/providers/index.d.ts +2 -3
  26. package/build/abstraction/providers/index.js +3 -5
  27. package/build/abstraction/providers/index.js.map +1 -1
  28. package/package.json +1 -1
@@ -4,7 +4,7 @@
4
4
  * ? that breaks when the call is successful.
5
5
  * ? This is to prevent any single RPC from being overloaded and
6
6
  * ? to be able to fail over to the next one in the list.
7
- */
7
+ */
8
8
  export default class CoinFinder {
9
9
  constructor();
10
10
  static findSol(targetChain: string): Promise<void>;
@@ -7,22 +7,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  * ? that breaks when the call is successful.
8
8
  * ? This is to prevent any single RPC from being overloaded and
9
9
  * ? to be able to fail over to the next one in the list.
10
- */
10
+ */
11
11
  class CoinFinder {
12
- constructor() {
13
- }
12
+ constructor() { }
14
13
  // TODO Implement supported chains (e.g. solana, multiversx, etc.) tokens cross search
15
14
  static async findSol(targetChain) {
16
- // TODO
15
+ // TODO Validate the target chain id
16
+ // TODO Get the wrapped sol address for the target chain
17
17
  }
18
18
  static async findMultiversx(targetChain) {
19
- // TODO
19
+ // TODO Validate the target chain id
20
+ // TODO Get the wrapped multiversx address for the target chain
20
21
  }
21
22
  static async findXRP(targetChain) {
22
- // TODO
23
+ // TODO Validate the target chain id
24
+ // TODO Get the wrapped xrp address for the target chain
23
25
  }
24
26
  static async findBTC(targetChain) {
25
- // TODO
27
+ // TODO Validate the target chain id
28
+ // TODO Get the wrapped btc address for the target chain
26
29
  }
27
30
  }
28
31
  exports.default = CoinFinder;
@@ -1 +1 @@
1
- {"version":3,"file":"CoinFinder.js","sourceRoot":"","sources":["../../../src/abstraction/CoinFinder.ts"],"names":[],"mappings":";;AAGA,kFAAkF;AAClF;;;;;;EAME;AAEF,MAAqB,UAAU;IAC3B;IAEA,CAAC;IAED,sFAAsF;IAEtF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,WAAmB;QACpC,OAAO;IACX,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,WAAmB;QAC3C,OAAO;IACX,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,WAAmB;QACpC,OAAO;IACX,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,WAAmB;QACpC,OAAO;IACX,CAAC;CACJ;AAtBD,6BAsBC"}
1
+ {"version":3,"file":"CoinFinder.js","sourceRoot":"","sources":["../../../src/abstraction/CoinFinder.ts"],"names":[],"mappings":";;AAIA,kFAAkF;AAClF;;;;;;GAMG;AAEH,MAAqB,UAAU;IAC3B,gBAAe,CAAC;IAEhB,sFAAsF;IAEtF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,WAAmB;QACpC,oCAAoC;QACpC,wDAAwD;IAC5D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,WAAmB;QAC3C,oCAAoC;QACpC,+DAA+D;IACnE,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,WAAmB;QACpC,oCAAoC;QACpC,wDAAwD;IAC5D,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,WAAmB;QACpC,oCAAoC;QACpC,wDAAwD;IAC5D,CAAC;CACJ;AAxBD,6BAwBC"}
@@ -4,10 +4,11 @@
4
4
  * ? that breaks when the call is successful.
5
5
  * ? This is to prevent any single RPC from being overloaded and
6
6
  * ? to be able to fail over to the next one in the list.
7
- */
7
+ */
8
8
  export default class EvmCoinFinder {
9
9
  constructor();
10
10
  static findNativeEth(targetChainIds: number[]): Promise<void>;
11
11
  static findNativeAssets(sourceChainId: number, targetChainIds: number[]): Promise<void>;
12
12
  static findTokenPairs(tokenAddress: string, sourceChainId: number, targetChainIds: number[]): Promise<void>;
13
+ static getNativeforSupportedChain(chain: string, targetChainId: number): void;
13
14
  }
@@ -7,13 +7,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  * ? that breaks when the call is successful.
8
8
  * ? This is to prevent any single RPC from being overloaded and
9
9
  * ? to be able to fail over to the next one in the list.
10
- */
10
+ */
11
11
  class EvmCoinFinder {
12
- constructor() {
13
- }
12
+ constructor() { }
14
13
  // TODO Method to find native and wrapped eth across evms (from mainnet to other evms)
15
14
  static async findNativeEth(targetChainIds) {
16
15
  // TODO
16
+ // TODO Get the wrapped eth address for the target chain
17
17
  }
18
18
  // TODO Method to find native and wrapped assets across evms (e.g. opt, arb, etc.)
19
19
  static async findNativeAssets(sourceChainId, targetChainIds) {
@@ -22,6 +22,14 @@ class EvmCoinFinder {
22
22
  // TODO Method to find token pairs on evms (from an evm to other(s) evm(s))
23
23
  static async findTokenPairs(tokenAddress, sourceChainId, targetChainIds) {
24
24
  // TODO
25
+ // TODO Validate the base token address for the source chain
26
+ // TODO Get the wrapped token address for the target chain if known or return false
27
+ }
28
+ static getNativeforSupportedChain(chain, targetChainId) {
29
+ // ! Typize this for supported chains
30
+ // TODO validate the chain
31
+ // TODO get the target chain id
32
+ // TODO return the native address for the target chain
25
33
  }
26
34
  }
27
35
  exports.default = EvmCoinFinder;
@@ -1 +1 @@
1
- {"version":3,"file":"EvmCoinFinder.js","sourceRoot":"","sources":["../../../src/abstraction/EvmCoinFinder.ts"],"names":[],"mappings":";;AAGA,kFAAkF;AAClF;;;;;;EAME;AAEF,MAAqB,aAAa;IAC9B;IAEA,CAAC;IAED,sFAAsF;IACtF,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,cAAwB;QAC/C,OAAO;IACX,CAAC;IAED,kFAAkF;IAClF,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,aAAqB,EAAE,cAAwB;QACzE,OAAO;IACX,CAAC;IAED,2EAA2E;IAC3E,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,YAAoB,EAAE,aAAqB,EAAE,cAAwB;QAC7F,OAAO;IACX,CAAC;CACJ;AAnBD,gCAmBC"}
1
+ {"version":3,"file":"EvmCoinFinder.js","sourceRoot":"","sources":["../../../src/abstraction/EvmCoinFinder.ts"],"names":[],"mappings":";;AAGA,kFAAkF;AAClF;;;;;;GAMG;AAEH,MAAqB,aAAa;IAC9B,gBAAe,CAAC;IAEhB,sFAAsF;IACtF,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,cAAwB;QAC/C,OAAO;QACP,wDAAwD;IAC5D,CAAC;IAED,kFAAkF;IAClF,MAAM,CAAC,KAAK,CAAC,gBAAgB,CACzB,aAAqB,EACrB,cAAwB;QAExB,OAAO;IACX,CAAC;IAED,2EAA2E;IAC3E,MAAM,CAAC,KAAK,CAAC,cAAc,CACvB,YAAoB,EACpB,aAAqB,EACrB,cAAwB;QAExB,OAAO;QACP,4DAA4D;QAC5D,mFAAmF;IACvF,CAAC;IAED,MAAM,CAAC,0BAA0B,CAAC,KAAa,EAAE,aAAqB;QAClE,qCAAqC;QACrC,0BAA0B;QAC1B,+BAA+B;QAC/B,sDAAsD;IAC1D,CAAC;CACJ;AAlCD,gCAkCC"}
@@ -0,0 +1,32 @@
1
+ export interface InferFromWritePayload {
2
+ demos_identity: {
3
+ address: string;
4
+ signedData: string;
5
+ signature: string;
6
+ };
7
+ target_identity: {
8
+ txHash: string;
9
+ targetAddress: string;
10
+ isEVM: boolean;
11
+ chainId: number | string;
12
+ rpcUrl?: string;
13
+ };
14
+ }
15
+ export interface InferFromSignaturePayload {
16
+ demos_identity: {
17
+ address: string;
18
+ signedData: string;
19
+ signature: string;
20
+ };
21
+ target_identity: {
22
+ signature: string;
23
+ signedData: string;
24
+ targetAddress: string;
25
+ isEVM: boolean;
26
+ chainId: number | string;
27
+ };
28
+ }
29
+ export default class Identities {
30
+ constructor();
31
+ inferIdentity(payload: InferFromWritePayload | InferFromSignaturePayload): Promise<string | false>;
32
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // TODO Implement the identities abstraction
3
+ // This should be able to query and set the GCR identities for a Demos address
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ class Identities {
6
+ constructor() { }
7
+ // Infer identity from either a write transaction or a signature
8
+ async inferIdentity(payload) {
9
+ const basePayload = {
10
+ method: "gcr_routine",
11
+ params: [payload],
12
+ };
13
+ // TODO Implement the RPC call
14
+ return false;
15
+ }
16
+ }
17
+ exports.default = Identities;
18
+ //# sourceMappingURL=Identities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Identities.js","sourceRoot":"","sources":["../../../src/abstraction/Identities.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,8EAA8E;;AAkC9E,MAAqB,UAAU;IAC3B,gBAAe,CAAC;IAEhB,gEAAgE;IAChE,KAAK,CAAC,aAAa,CAAC,OAA0D;QAC1E,MAAM,WAAW,GAAG;YAChB,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE,CAAC,OAAO,CAAC;SACpB,CAAA;QACD,8BAA8B;QAC9B,OAAO,KAAK,CAAA;IAChB,CAAC;CAEJ;AAbD,6BAaC"}
@@ -6,4 +6,6 @@
6
6
  */
7
7
  import EvmCoinFinder from "./EvmCoinFinder";
8
8
  import CoinFinder from "./CoinFinder";
9
- export { EvmCoinFinder, CoinFinder };
9
+ import Identities from "./Identities";
10
+ import { InferFromWritePayload, InferFromSignaturePayload } from "./Identities";
11
+ export { EvmCoinFinder, CoinFinder, Identities, InferFromWritePayload, InferFromSignaturePayload };
@@ -9,9 +9,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CoinFinder = exports.EvmCoinFinder = void 0;
12
+ exports.Identities = exports.CoinFinder = exports.EvmCoinFinder = void 0;
13
13
  const EvmCoinFinder_1 = __importDefault(require("./EvmCoinFinder"));
14
14
  exports.EvmCoinFinder = EvmCoinFinder_1.default;
15
15
  const CoinFinder_1 = __importDefault(require("./CoinFinder"));
16
16
  exports.CoinFinder = CoinFinder_1.default;
17
+ const Identities_1 = __importDefault(require("./Identities"));
18
+ exports.Identities = Identities_1.default;
17
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/abstraction/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,oEAA4C;AAGnC,wBAHF,uBAAa,CAGE;AAFtB,8DAAsC;AAEd,qBAFjB,oBAAU,CAEiB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/abstraction/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,oEAA4C;AAKnC,wBALF,uBAAa,CAKE;AAJtB,8DAAsC;AAId,qBAJjB,oBAAU,CAIiB;AAHlC,8DAAsC;AAGF,qBAH7B,oBAAU,CAG6B"}
@@ -0,0 +1,39 @@
1
+ /** NOTE
2
+ * This is the singleton class that contains the list of providers for the abstraction layer.
3
+ * It also contains the methods to register new providers.
4
+ *
5
+ * INFO for developers:
6
+ * - The providers can be registered by adding a new provider registration file in the ./index.ts file.
7
+ * - The provider registration files use the registerEVM and registerChainProviders methods to register the providers.
8
+ * - The registerEVM method takes a chainId and an array of RPC URLs as arguments.
9
+ * - The registerChainProviders method takes a chain type, a network, and an array of RPC URLs as arguments.
10
+ * - For an example of how to register a new provider, see the ./ankr.ts file.
11
+ * - The Providers.ts file export the singleton instance of the AbstractionProviders class, already registered with all providers.
12
+ *
13
+ * NOTE: The Providers object should only used internally (e.g. in EvmCoinFinder.ts and CoinFinder.ts).
14
+ * This is due to the fact that it is initialized with all the providers at runtime.
15
+ */
16
+ declare class _AbstractionProviders {
17
+ static _instance: _AbstractionProviders;
18
+ constructor();
19
+ static getInstance(): _AbstractionProviders;
20
+ evm: {
21
+ [chainName: string]: string[];
22
+ };
23
+ solana: {
24
+ [key in "mainnet" | "devnet" | "testnet"]: string[];
25
+ };
26
+ multiversx: {
27
+ [key in "mainnet" | "devnet" | "testnet"]: string[];
28
+ };
29
+ xrp: {
30
+ [key in "mainnet" | "testnet"]: string[];
31
+ };
32
+ bitcoin: {
33
+ [key in "mainnet" | "testnet"]: string[];
34
+ };
35
+ registerEVM(chainName: string, rpcUrls: string[]): void;
36
+ registerChainProviders(chain: "solana" | "multiversx" | "xrp" | "bitcoin", network: string, rpcUrls: string[]): void;
37
+ }
38
+ declare const AbstractionProvidersInstance: typeof _AbstractionProviders.getInstance;
39
+ export default AbstractionProvidersInstance;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /** NOTE
4
+ * This is the singleton class that contains the list of providers for the abstraction layer.
5
+ * It also contains the methods to register new providers.
6
+ *
7
+ * INFO for developers:
8
+ * - The providers can be registered by adding a new provider registration file in the ./index.ts file.
9
+ * - The provider registration files use the registerEVM and registerChainProviders methods to register the providers.
10
+ * - The registerEVM method takes a chainId and an array of RPC URLs as arguments.
11
+ * - The registerChainProviders method takes a chain type, a network, and an array of RPC URLs as arguments.
12
+ * - For an example of how to register a new provider, see the ./ankr.ts file.
13
+ * - The Providers.ts file export the singleton instance of the AbstractionProviders class, already registered with all providers.
14
+ *
15
+ * NOTE: The Providers object should only used internally (e.g. in EvmCoinFinder.ts and CoinFinder.ts).
16
+ * This is due to the fact that it is initialized with all the providers at runtime.
17
+ */
18
+ class _AbstractionProviders {
19
+ // This is the list of providers for the abstraction layer
20
+ constructor() {
21
+ this.evm = {};
22
+ this.solana = {
23
+ mainnet: [],
24
+ devnet: [],
25
+ testnet: [],
26
+ };
27
+ this.multiversx = {
28
+ mainnet: [],
29
+ devnet: [],
30
+ testnet: [],
31
+ };
32
+ this.xrp = {
33
+ mainnet: [],
34
+ testnet: [],
35
+ };
36
+ this.bitcoin = {
37
+ mainnet: [],
38
+ testnet: [],
39
+ };
40
+ }
41
+ // Singleton
42
+ static getInstance() {
43
+ if (!_AbstractionProviders._instance) {
44
+ _AbstractionProviders._instance = new _AbstractionProviders();
45
+ }
46
+ return _AbstractionProviders._instance;
47
+ }
48
+ // Register EVM providers
49
+ registerEVM(chainName, rpcUrls) {
50
+ if (!this.evm[chainName]) {
51
+ this.evm[chainName] = [];
52
+ }
53
+ this.evm[chainName].push(...rpcUrls);
54
+ }
55
+ // Register chain providers
56
+ registerChainProviders(chain, network, rpcUrls) {
57
+ if (this[chain] && this[chain][network]) {
58
+ this[chain][network].push(...rpcUrls);
59
+ }
60
+ }
61
+ }
62
+ // Create and initialize the singleton immediately
63
+ // NOTE We export the getInstance method instead of the instance itself to ensure we update the singleton each time
64
+ const AbstractionProvidersInstance = _AbstractionProviders.getInstance;
65
+ // Export the initialized instance
66
+ exports.default = AbstractionProvidersInstance;
67
+ //# sourceMappingURL=AbstractionProviders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractionProviders.js","sourceRoot":"","sources":["../../../../src/abstraction/providers/AbstractionProviders.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,qBAAqB;IAGvB,0DAA0D;IAC1D;QACI,IAAI,CAAC,GAAG,GAAG,EAAE,CAAA;QACb,IAAI,CAAC,MAAM,GAAG;YACV,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,EAAE;SACd,CAAA;QACD,IAAI,CAAC,UAAU,GAAG;YACd,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,EAAE;SACd,CAAA;QACD,IAAI,CAAC,GAAG,GAAG;YACP,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;SACd,CAAA;QACD,IAAI,CAAC,OAAO,GAAG;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;SACd,CAAA;IACL,CAAC;IAED,YAAY;IACZ,MAAM,CAAC,WAAW;QACd,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE,CAAC;YACnC,qBAAqB,CAAC,SAAS,GAAG,IAAI,qBAAqB,EAAE,CAAA;QACjE,CAAC;QACD,OAAO,qBAAqB,CAAC,SAAS,CAAA;IAC1C,CAAC;IAqBD,yBAAyB;IACzB,WAAW,CAAC,SAAiB,EAAE,OAAiB;QAC5C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,CAAA;QAC5B,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAA;IACxC,CAAC;IAED,2BAA2B;IAC3B,sBAAsB,CAClB,KAAkD,EAClD,OAAe,EACf,OAAiB;QAEjB,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAA;QACzC,CAAC;IACL,CAAC;CAGJ;AAED,kDAAkD;AAClD,mHAAmH;AACnH,MAAM,4BAA4B,GAAG,qBAAqB,CAAC,WAAW,CAAA;AAEtE,kCAAkC;AAClC,kBAAe,4BAA4B,CAAA"}
@@ -0,0 +1,25 @@
1
+ export declare const tokenAddresses: {
2
+ eth: {
3
+ mainnet: string;
4
+ sepolia: string;
5
+ holesky: string;
6
+ wrapped: {
7
+ polygon: {
8
+ mainnet: string;
9
+ };
10
+ };
11
+ };
12
+ btc: {
13
+ mainnet: string;
14
+ wrapped: {
15
+ ethereum: {
16
+ mainnet: string;
17
+ sepolia: string;
18
+ holesky: string;
19
+ };
20
+ polygon: {
21
+ mainnet: string;
22
+ };
23
+ };
24
+ };
25
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // ! This is an absolute test and could be changed anytime
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.tokenAddresses = void 0;
5
+ exports.tokenAddresses = {
6
+ // ANCHOR Ethereum
7
+ eth: {
8
+ mainnet: "0x0000000000000000000000000000000000000000",
9
+ sepolia: "0x0000000000000000000000000000000000000000",
10
+ holesky: "0x0000000000000000000000000000000000000000",
11
+ wrapped: {
12
+ polygon: {
13
+ mainnet: "0x0000000000000000000000000000000000000000",
14
+ }
15
+ }
16
+ },
17
+ // ANCHOR Bitcoin
18
+ btc: {
19
+ mainnet: "0x0000000000000000000000000000000000000000",
20
+ wrapped: {
21
+ ethereum: {
22
+ mainnet: "0x0000000000000000000000000000000000000000",
23
+ sepolia: "0x0000000000000000000000000000000000000000",
24
+ holesky: "0x0000000000000000000000000000000000000000",
25
+ },
26
+ polygon: {
27
+ mainnet: "0x0000000000000000000000000000000000000000",
28
+ }
29
+ }
30
+ },
31
+ };
32
+ //# sourceMappingURL=CoinAddresses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoinAddresses.js","sourceRoot":"","sources":["../../../../src/abstraction/providers/CoinAddresses.ts"],"names":[],"mappings":";AAAA,0DAA0D;;;AAE7C,QAAA,cAAc,GAAG;IAC1B,kBAAkB;IAClB,GAAG,EAAE;QACD,OAAO,EAAE,4CAA4C;QACrD,OAAO,EAAE,4CAA4C;QACrD,OAAO,EAAE,4CAA4C;QACrD,OAAO,EAAE;YACL,OAAO,EAAE;gBACL,OAAO,EAAE,4CAA4C;aACxD;SACJ;KACJ;IACD,iBAAiB;IACjB,GAAG,EAAE;QACD,OAAO,EAAE,4CAA4C;QACrD,OAAO,EAAE;YACL,QAAQ,EAAE;gBACN,OAAO,EAAE,4CAA4C;gBACrD,OAAO,EAAE,4CAA4C;gBACrD,OAAO,EAAE,4CAA4C;aACxD;YACD,OAAO,EAAE;gBACL,OAAO,EAAE,4CAA4C;aACxD;SACJ;KACJ;CACJ,CAAA"}
@@ -1,38 +1,12 @@
1
- /** NOTE
2
- * This is the singleton class that contains the list of providers for the abstraction layer.
3
- * It also contains the methods to register new providers.
4
- *
5
- * INFO for developers:
6
- * - The providers can be registered by adding a new provider registration file in the ./index.ts file.
7
- * - The provider registration files use the registerEVM and registerChainProviders methods to register the providers.
8
- * - The registerEVM method takes a chainId and an array of RPC URLs as arguments.
9
- * - The registerChainProviders method takes a chain type, a network, and an array of RPC URLs as arguments.
10
- * - For an example of how to register a new provider, see the ./ankr.ts file.
11
- *
12
- * NOTE: The Providers() getter is only used internally (e.g. in EvmCoinFinder.ts and CoinFinder.ts).
13
- * This is due to the fact that it is initialized with all the providers at runtime.
14
- */
15
- declare class _AbstractionProviders {
16
- static _instance: _AbstractionProviders;
17
- constructor();
18
- static getInstance(): _AbstractionProviders;
1
+ declare const Providers: {
19
2
  evm: {
20
3
  [chainName: string]: string[];
21
4
  };
22
- solana: {
23
- [key in "mainnet" | "devnet" | "testnet"]: string[];
24
- };
25
- multiversx: {
26
- [key in "mainnet" | "devnet" | "testnet"]: string[];
27
- };
28
- xrp: {
29
- [key in "mainnet" | "testnet"]: string[];
30
- };
31
- bitcoin: {
32
- [key in "mainnet" | "testnet"]: string[];
33
- };
5
+ solana: { [key in "mainnet" | "devnet" | "testnet"]: string[]; };
6
+ multiversx: { [key in "mainnet" | "devnet" | "testnet"]: string[]; };
7
+ xrp: { [key in "mainnet" | "testnet"]: string[]; };
8
+ bitcoin: { [key in "mainnet" | "testnet"]: string[]; };
34
9
  registerEVM(chainName: string, rpcUrls: string[]): void;
35
10
  registerChainProviders(chain: "solana" | "multiversx" | "xrp" | "bitcoin", network: string, rpcUrls: string[]): void;
36
- }
37
- declare const Providers: typeof _AbstractionProviders.getInstance;
11
+ };
38
12
  export default Providers;
@@ -1,66 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- /** NOTE
4
- * This is the singleton class that contains the list of providers for the abstraction layer.
5
- * It also contains the methods to register new providers.
6
- *
7
- * INFO for developers:
8
- * - The providers can be registered by adding a new provider registration file in the ./index.ts file.
9
- * - The provider registration files use the registerEVM and registerChainProviders methods to register the providers.
10
- * - The registerEVM method takes a chainId and an array of RPC URLs as arguments.
11
- * - The registerChainProviders method takes a chain type, a network, and an array of RPC URLs as arguments.
12
- * - For an example of how to register a new provider, see the ./ankr.ts file.
13
- *
14
- * NOTE: The Providers() getter is only used internally (e.g. in EvmCoinFinder.ts and CoinFinder.ts).
15
- * This is due to the fact that it is initialized with all the providers at runtime.
16
- */
17
- class _AbstractionProviders {
18
- // This is the list of providers for the abstraction layer
19
- constructor() {
20
- this.evm = {};
21
- this.solana = {
22
- mainnet: [],
23
- devnet: [],
24
- testnet: [],
25
- };
26
- this.multiversx = {
27
- mainnet: [],
28
- devnet: [],
29
- testnet: [],
30
- };
31
- this.xrp = {
32
- mainnet: [],
33
- testnet: [],
34
- };
35
- this.bitcoin = {
36
- mainnet: [],
37
- testnet: [],
38
- };
39
- }
40
- // Singleton
41
- static getInstance() {
42
- if (!_AbstractionProviders._instance) {
43
- _AbstractionProviders._instance = new _AbstractionProviders();
44
- }
45
- return _AbstractionProviders._instance;
46
- }
47
- // Register EVM providers
48
- registerEVM(chainName, rpcUrls) {
49
- if (!this.evm[chainName]) {
50
- this.evm[chainName] = [];
51
- }
52
- this.evm[chainName].push(...rpcUrls);
53
- }
54
- // Register chain providers
55
- registerChainProviders(chain, network, rpcUrls) {
56
- if (this[chain] && this[chain][network]) {
57
- this[chain][network].push(...rpcUrls);
58
- }
59
- }
60
- }
61
- // Create and initialize the singleton immediately
62
- // NOTE We export the getInstance method instead of the instance itself to ensure we update the singleton each time
63
- const Providers = _AbstractionProviders.getInstance;
64
- // Export the initialized instance
6
+ const AbstractionProviders_1 = __importDefault(require("./AbstractionProviders"));
7
+ const ankr_1 = __importDefault(require("./ankr"));
8
+ // Register the providers
9
+ (0, ankr_1.default)();
10
+ // Exporting the singleton instance of the Providers class, already registered with all providers
11
+ // Being a const, it should maintain the snapshot of the instance at the time of the import
12
+ const Providers = (0, AbstractionProviders_1.default)();
65
13
  exports.default = Providers;
66
14
  //# sourceMappingURL=Providers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Providers.js","sourceRoot":"","sources":["../../../../src/abstraction/providers/Providers.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,qBAAqB;IAGvB,0DAA0D;IAC1D;QACI,IAAI,CAAC,GAAG,GAAG,EAAE,CAAA;QACb,IAAI,CAAC,MAAM,GAAG;YACV,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,EAAE;SACd,CAAA;QACD,IAAI,CAAC,UAAU,GAAG;YACd,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,EAAE;SACd,CAAA;QACD,IAAI,CAAC,GAAG,GAAG;YACP,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;SACd,CAAA;QACD,IAAI,CAAC,OAAO,GAAG;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;SACd,CAAA;IACL,CAAC;IAED,YAAY;IACZ,MAAM,CAAC,WAAW;QACd,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE,CAAC;YACnC,qBAAqB,CAAC,SAAS,GAAG,IAAI,qBAAqB,EAAE,CAAA;QACjE,CAAC;QACD,OAAO,qBAAqB,CAAC,SAAS,CAAA;IAC1C,CAAC;IAqBD,yBAAyB;IACzB,WAAW,CAAC,SAAiB,EAAE,OAAiB;QAC5C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,CAAA;QAC5B,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAA;IACxC,CAAC;IAED,2BAA2B;IAC3B,sBAAsB,CAClB,KAAkD,EAClD,OAAe,EACf,OAAiB;QAEjB,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAA;QACzC,CAAC;IACL,CAAC;CAGJ;AAED,kDAAkD;AAClD,mHAAmH;AACnH,MAAM,SAAS,GAAG,qBAAqB,CAAC,WAAW,CAAA;AAEnD,kCAAkC;AAClC,kBAAe,SAAS,CAAA"}
1
+ {"version":3,"file":"Providers.js","sourceRoot":"","sources":["../../../../src/abstraction/providers/Providers.ts"],"names":[],"mappings":";;;;;AAAA,kFAAiE;AACjE,kDAA0C;AAE1C,yBAAyB;AACzB,IAAA,cAAqB,GAAE,CAAA;AAEvB,iGAAiG;AACjG,2FAA2F;AAC3F,MAAM,SAAS,GAAG,IAAA,8BAA4B,GAAE,CAAA;AAEhD,kBAAe,SAAS,CAAA"}
@@ -1 +1 @@
1
- export {};
1
+ export default function registerAnkrProviders(): void;
@@ -3,29 +3,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = registerAnkrProviders;
6
7
  /** NOTE
7
8
  * This file registers the providers for the ankr network.
8
9
  * INFO for developers:
9
10
  * - Note how the providers are registered for each chain.
10
11
  * - You can use this as a template for registering new providers.
11
12
  */
12
- const Providers_1 = __importDefault(require("./Providers"));
13
- // ANCHOR Evm chains
14
- // SECTION Ethereum
15
- (0, Providers_1.default)().registerEVM("ethereum", ["https://rpc.ankr.com/eth"]);
16
- (0, Providers_1.default)().registerEVM("ethereum_holesky", ["https://rpc.ankr.com/eth_holesky"]);
17
- (0, Providers_1.default)().registerEVM("ethereum_sepolia", ["https://rpc.ankr.com/eth_sepolia"]);
18
- // ANCHOR Non-EVM chains
19
- // SECTION Bitcoin
20
- (0, Providers_1.default)().registerChainProviders("bitcoin", "mainnet", [
21
- "https://rpc.ankr.com/btc",
22
- ]);
23
- (0, Providers_1.default)().registerChainProviders("bitcoin", "testnet", [
24
- "https://rpc.ankr.com/btc_signet",
25
- ]);
26
- // SECTION Solana
27
- (0, Providers_1.default)().registerChainProviders("solana", "devnet", [
28
- "https://rpc.ankr.com/solana_devnet",
29
- ]);
30
- // TODO Add providers from ankr for other chains
13
+ const AbstractionProviders_1 = __importDefault(require("./AbstractionProviders"));
14
+ function registerAnkrProviders() {
15
+ // ANCHOR Evm chains
16
+ // SECTION Ethereum
17
+ (0, AbstractionProviders_1.default)().registerEVM("ethereum", [
18
+ "https://rpc.ankr.com/eth",
19
+ ]);
20
+ (0, AbstractionProviders_1.default)().registerEVM("ethereum_holesky", [
21
+ "https://rpc.ankr.com/eth_holesky",
22
+ ]);
23
+ (0, AbstractionProviders_1.default)().registerEVM("ethereum_sepolia", [
24
+ "https://rpc.ankr.com/eth_sepolia",
25
+ ]);
26
+ // ANCHOR Non-EVM chains
27
+ // SECTION Bitcoin
28
+ (0, AbstractionProviders_1.default)().registerChainProviders("bitcoin", "mainnet", ["https://rpc.ankr.com/btc"]);
29
+ (0, AbstractionProviders_1.default)().registerChainProviders("bitcoin", "testnet", ["https://rpc.ankr.com/btc_signet"]);
30
+ // SECTION Solana
31
+ (0, AbstractionProviders_1.default)().registerChainProviders("solana", "devnet", [
32
+ "https://rpc.ankr.com/solana_devnet",
33
+ ]);
34
+ // TODO Add providers from ankr for other chains
35
+ }
31
36
  //# sourceMappingURL=ankr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ankr.js","sourceRoot":"","sources":["../../../../src/abstraction/providers/ankr.ts"],"names":[],"mappings":";;;;;AAAA;;;;;GAKG;AACH,4DAAmC;AAEnC,oBAAoB;AAEpB,mBAAmB;AACnB,IAAA,mBAAS,GAAE,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC,0BAA0B,CAAC,CAAC,CAAA;AACjE,IAAA,mBAAS,GAAE,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC,kCAAkC,CAAC,CAAC,CAAA;AACjF,IAAA,mBAAS,GAAE,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC,kCAAkC,CAAC,CAAC,CAAA;AAEjF,wBAAwB;AAExB,kBAAkB;AAClB,IAAA,mBAAS,GAAE,CAAC,sBAAsB,CAAC,SAAS,EAAE,SAAS,EAAE;IACrD,0BAA0B;CAC7B,CAAC,CAAA;AACF,IAAA,mBAAS,GAAE,CAAC,sBAAsB,CAAC,SAAS,EAAE,SAAS,EAAE;IACrD,iCAAiC;CACpC,CAAC,CAAA;AAEF,iBAAiB;AACjB,IAAA,mBAAS,GAAE,CAAC,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE;IACnD,oCAAoC;CACvC,CAAC,CAAA;AAEF,gDAAgD"}
1
+ {"version":3,"file":"ankr.js","sourceRoot":"","sources":["../../../../src/abstraction/providers/ankr.ts"],"names":[],"mappings":";;;;;AAQA,wCAkCC;AA1CD;;;;;GAKG;AACH,kFAAiE;AAEjE,SAAwB,qBAAqB;IACzC,oBAAoB;IAEpB,mBAAmB;IACnB,IAAA,8BAA4B,GAAE,CAAC,WAAW,CAAC,UAAU,EAAE;QACnD,0BAA0B;KAC7B,CAAC,CAAA;IACF,IAAA,8BAA4B,GAAE,CAAC,WAAW,CAAC,kBAAkB,EAAE;QAC3D,kCAAkC;KACrC,CAAC,CAAA;IACF,IAAA,8BAA4B,GAAE,CAAC,WAAW,CAAC,kBAAkB,EAAE;QAC3D,kCAAkC;KACrC,CAAC,CAAA;IAEF,wBAAwB;IAExB,kBAAkB;IAClB,IAAA,8BAA4B,GAAE,CAAC,sBAAsB,CACjD,SAAS,EACT,SAAS,EACT,CAAC,0BAA0B,CAAC,CAC/B,CAAA;IACD,IAAA,8BAA4B,GAAE,CAAC,sBAAsB,CACjD,SAAS,EACT,SAAS,EACT,CAAC,iCAAiC,CAAC,CACtC,CAAA;IAED,iBAAiB;IACjB,IAAA,8BAA4B,GAAE,CAAC,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE;QACtE,oCAAoC;KACvC,CAAC,CAAA;IAEF,gDAAgD;AACpD,CAAC"}
@@ -1,3 +1,2 @@
1
- import './ankr';
2
- import Providers from './Providers';
3
- export { Providers };
1
+ import Providers from "./Providers";
2
+ export default Providers;
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
+ // SECTION Import provider registration files
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
5
  };
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Providers = void 0;
7
- // SECTION Import provider registration files (providers get registered here)
8
- require("./ankr");
9
- // SECTION Import the singleton instance of the Providers class
10
7
  const Providers_1 = __importDefault(require("./Providers"));
11
- exports.Providers = Providers_1.default;
8
+ // NOTE This is a const, so itmaintain the snapshot of the instance at the time of the import
9
+ exports.default = Providers_1.default;
12
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/abstraction/providers/index.ts"],"names":[],"mappings":";;;;;;AAAA,6EAA6E;AAC7E,kBAAgB;AAEhB,+DAA+D;AAC/D,4DAAoC;AAG3B,oBAHF,mBAAS,CAGE"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/abstraction/providers/index.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;;;AAE7C,4DAAmC;AAEnC,6FAA6F;AAC7F,kBAAe,mBAAS,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kynesyslabs/demosdk",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "author": "Kynesys Labs",