@orb-labs/orby-core 0.0.13 → 0.0.15

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 (141) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/actions/operation.d.ts +1 -1
  3. package/dist/actions/operation.js +5 -3
  4. package/dist/cjs/actions/account_cluster.d.ts +32 -0
  5. package/dist/cjs/actions/account_cluster.js +211 -0
  6. package/dist/cjs/actions/admin.d.ts +17 -0
  7. package/dist/cjs/actions/admin.js +43 -0
  8. package/dist/cjs/actions/application.d.ts +6 -0
  9. package/dist/cjs/actions/application.js +20 -0
  10. package/dist/cjs/actions/blockchain.d.ts +16 -0
  11. package/dist/cjs/actions/blockchain.js +39 -0
  12. package/dist/cjs/actions/instance.d.ts +15 -0
  13. package/dist/cjs/actions/instance.js +98 -0
  14. package/dist/cjs/actions/operation.d.ts +99 -0
  15. package/dist/cjs/actions/operation.js +345 -0
  16. package/dist/cjs/actions/token.d.ts +15 -0
  17. package/dist/cjs/actions/token.js +50 -0
  18. package/dist/cjs/constants.d.ts +14 -0
  19. package/dist/cjs/constants.js +139 -0
  20. package/dist/cjs/entities/account.d.ts +14 -0
  21. package/dist/cjs/entities/account.js +49 -0
  22. package/dist/cjs/entities/financial/account_balance.d.ts +12 -0
  23. package/dist/cjs/entities/financial/account_balance.js +35 -0
  24. package/dist/cjs/entities/financial/asset.d.ts +31 -0
  25. package/dist/cjs/entities/financial/asset.js +42 -0
  26. package/dist/cjs/entities/financial/currency.d.ts +41 -0
  27. package/dist/cjs/entities/financial/currency.js +56 -0
  28. package/dist/cjs/entities/financial/currency_amount.d.ts +34 -0
  29. package/dist/cjs/entities/financial/currency_amount.js +99 -0
  30. package/dist/cjs/entities/financial/fungible_token.d.ts +41 -0
  31. package/dist/cjs/entities/financial/fungible_token.js +68 -0
  32. package/dist/cjs/entities/financial/fungible_token_amount.d.ts +36 -0
  33. package/dist/cjs/entities/financial/fungible_token_amount.js +102 -0
  34. package/dist/cjs/entities/financial/non_fungible_token.d.ts +39 -0
  35. package/dist/cjs/entities/financial/non_fungible_token.js +65 -0
  36. package/dist/cjs/entities/financial/semi_fungible_token.d.ts +41 -0
  37. package/dist/cjs/entities/financial/semi_fungible_token.js +67 -0
  38. package/dist/cjs/entities/library_request.d.ts +8 -0
  39. package/dist/cjs/entities/library_request.js +37 -0
  40. package/dist/cjs/entities/state.d.ts +22 -0
  41. package/dist/cjs/entities/state.js +106 -0
  42. package/dist/cjs/enums.d.ts +116 -0
  43. package/dist/cjs/enums.js +138 -0
  44. package/dist/cjs/index.d.ts +29 -0
  45. package/dist/cjs/index.js +49 -0
  46. package/dist/cjs/interfaces/account_cluster.d.ts +30 -0
  47. package/dist/cjs/interfaces/account_cluster.js +2 -0
  48. package/dist/cjs/interfaces/admin.d.ts +14 -0
  49. package/dist/cjs/interfaces/admin.js +2 -0
  50. package/dist/cjs/interfaces/application.d.ts +3 -0
  51. package/dist/cjs/interfaces/application.js +2 -0
  52. package/dist/cjs/interfaces/blockchain.d.ts +13 -0
  53. package/dist/cjs/interfaces/blockchain.js +2 -0
  54. package/dist/cjs/interfaces/instance.d.ts +12 -0
  55. package/dist/cjs/interfaces/instance.js +2 -0
  56. package/dist/cjs/interfaces/operation.d.ts +97 -0
  57. package/dist/cjs/interfaces/operation.js +2 -0
  58. package/dist/cjs/interfaces/orby.d.ts +9 -0
  59. package/dist/cjs/interfaces/orby.js +2 -0
  60. package/dist/cjs/interfaces/token.d.ts +12 -0
  61. package/dist/cjs/interfaces/token.js +2 -0
  62. package/dist/cjs/types.d.ts +152 -0
  63. package/dist/cjs/types.js +2 -0
  64. package/dist/cjs/utils/action_helpers.d.ts +22 -0
  65. package/dist/cjs/utils/action_helpers.js +274 -0
  66. package/dist/cjs/utils/utils.d.ts +10 -0
  67. package/dist/cjs/utils/utils.js +79 -0
  68. package/dist/cjs/utils/validateAndParseAddress.d.ts +10 -0
  69. package/dist/cjs/utils/validateAndParseAddress.js +29 -0
  70. package/dist/esm/actions/account_cluster.d.ts +32 -0
  71. package/dist/esm/actions/account_cluster.js +207 -0
  72. package/dist/esm/actions/admin.d.ts +17 -0
  73. package/dist/esm/actions/admin.js +39 -0
  74. package/dist/esm/actions/application.d.ts +6 -0
  75. package/dist/esm/actions/application.js +16 -0
  76. package/dist/esm/actions/blockchain.d.ts +16 -0
  77. package/dist/esm/actions/blockchain.js +35 -0
  78. package/dist/esm/actions/instance.d.ts +15 -0
  79. package/dist/esm/actions/instance.js +94 -0
  80. package/dist/esm/actions/operation.d.ts +99 -0
  81. package/dist/esm/actions/operation.js +341 -0
  82. package/dist/esm/actions/token.d.ts +15 -0
  83. package/dist/esm/actions/token.js +46 -0
  84. package/dist/esm/constants.d.ts +14 -0
  85. package/dist/esm/constants.js +133 -0
  86. package/dist/esm/entities/account.d.ts +14 -0
  87. package/dist/esm/entities/account.js +45 -0
  88. package/dist/esm/entities/financial/account_balance.d.ts +12 -0
  89. package/dist/esm/entities/financial/account_balance.js +31 -0
  90. package/dist/esm/entities/financial/asset.d.ts +31 -0
  91. package/dist/esm/entities/financial/asset.js +38 -0
  92. package/dist/esm/entities/financial/currency.d.ts +41 -0
  93. package/dist/esm/entities/financial/currency.js +49 -0
  94. package/dist/esm/entities/financial/currency_amount.d.ts +34 -0
  95. package/dist/esm/entities/financial/currency_amount.js +92 -0
  96. package/dist/esm/entities/financial/fungible_token.d.ts +41 -0
  97. package/dist/esm/entities/financial/fungible_token.js +64 -0
  98. package/dist/esm/entities/financial/fungible_token_amount.d.ts +36 -0
  99. package/dist/esm/entities/financial/fungible_token_amount.js +95 -0
  100. package/dist/esm/entities/financial/non_fungible_token.d.ts +39 -0
  101. package/dist/esm/entities/financial/non_fungible_token.js +61 -0
  102. package/dist/esm/entities/financial/semi_fungible_token.d.ts +41 -0
  103. package/dist/esm/entities/financial/semi_fungible_token.js +63 -0
  104. package/dist/esm/entities/library_request.d.ts +8 -0
  105. package/dist/esm/entities/library_request.js +30 -0
  106. package/dist/esm/entities/state.d.ts +22 -0
  107. package/dist/esm/entities/state.js +102 -0
  108. package/dist/esm/enums.d.ts +116 -0
  109. package/dist/esm/enums.js +135 -0
  110. package/dist/esm/index.d.ts +29 -0
  111. package/dist/esm/index.js +33 -0
  112. package/dist/esm/interfaces/account_cluster.d.ts +30 -0
  113. package/dist/esm/interfaces/account_cluster.js +1 -0
  114. package/dist/esm/interfaces/admin.d.ts +14 -0
  115. package/dist/esm/interfaces/admin.js +1 -0
  116. package/dist/esm/interfaces/application.d.ts +3 -0
  117. package/dist/esm/interfaces/application.js +1 -0
  118. package/dist/esm/interfaces/blockchain.d.ts +13 -0
  119. package/dist/esm/interfaces/blockchain.js +1 -0
  120. package/dist/esm/interfaces/instance.d.ts +12 -0
  121. package/dist/esm/interfaces/instance.js +1 -0
  122. package/dist/esm/interfaces/operation.d.ts +97 -0
  123. package/dist/esm/interfaces/operation.js +1 -0
  124. package/dist/esm/interfaces/orby.d.ts +9 -0
  125. package/dist/esm/interfaces/orby.js +1 -0
  126. package/dist/esm/interfaces/token.d.ts +12 -0
  127. package/dist/esm/interfaces/token.js +1 -0
  128. package/dist/esm/types.d.ts +152 -0
  129. package/dist/esm/types.js +1 -0
  130. package/dist/esm/utils/action_helpers.d.ts +22 -0
  131. package/dist/esm/utils/action_helpers.js +250 -0
  132. package/dist/esm/utils/utils.d.ts +10 -0
  133. package/dist/esm/utils/utils.js +70 -0
  134. package/dist/esm/utils/validateAndParseAddress.d.ts +10 -0
  135. package/dist/esm/utils/validateAndParseAddress.js +25 -0
  136. package/dist/interfaces/operation.d.ts +1 -1
  137. package/dist/tsconfig.cjs.tsbuildinfo +1 -0
  138. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  139. package/dist/tsconfig.tsbuildinfo +1 -1
  140. package/dist/utils/action_helpers.js +1 -1
  141. package/package.json +16 -7
@@ -0,0 +1,41 @@
1
+ import { Currency } from "./currency.js";
2
+ import { TokenType } from "../../enums.js";
3
+ /**
4
+ * Represents an ERC1155 token with a unique address and some metadata.
5
+ */
6
+ export declare class SemiFungibleToken extends Currency {
7
+ readonly isNative: false;
8
+ readonly isToken: true;
9
+ /**
10
+ * The contract address on the chain on which this token lives
11
+ */
12
+ readonly address: string;
13
+ /**
14
+ * The chain ID on which this token resides
15
+ */
16
+ readonly chainId: bigint;
17
+ readonly url?: string;
18
+ /**
19
+ *
20
+ * @param chainId The chain ID on which this token resides
21
+ * @param address The contract address on the chain on which this token lives
22
+ * @param decimals {@link Currency#decimals}
23
+ * @param symbol {@link Currency#symbol}
24
+ * @param name {@link Currency#name}
25
+ * @param url The URL of the token's metadata
26
+ * @param bypassChecksum If true it only checks for length === 42, startsWith 0x and contains only hex characters
27
+ */
28
+ constructor(chainId: bigint, address: string, decimals: number, symbol: string, name: string, url?: string, bypassChecksum?: boolean, coinGeckoId?: string);
29
+ static toSemiFungibleToken(sft?: any): SemiFungibleToken;
30
+ /**
31
+ * Returns true if the two tokens are equivalent, i.e. have the same chainId and address.
32
+ * @param other other token to compare
33
+ */
34
+ equals(other: SemiFungibleToken): boolean;
35
+ /**
36
+ * Returns the currency object that this token represents
37
+ */
38
+ currency(): Currency;
39
+ type(): TokenType;
40
+ identifier(): string;
41
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SemiFungibleToken = void 0;
4
+ const currency_js_1 = require("./currency.js");
5
+ const validateAndParseAddress_js_1 = require("../../utils/validateAndParseAddress.js");
6
+ const enums_js_1 = require("../../enums.js");
7
+ /**
8
+ * Represents an ERC1155 token with a unique address and some metadata.
9
+ */
10
+ class SemiFungibleToken extends currency_js_1.Currency {
11
+ /**
12
+ *
13
+ * @param chainId The chain ID on which this token resides
14
+ * @param address The contract address on the chain on which this token lives
15
+ * @param decimals {@link Currency#decimals}
16
+ * @param symbol {@link Currency#symbol}
17
+ * @param name {@link Currency#name}
18
+ * @param url The URL of the token's metadata
19
+ * @param bypassChecksum If true it only checks for length === 42, startsWith 0x and contains only hex characters
20
+ */
21
+ constructor(chainId, address, decimals, symbol, name, url, bypassChecksum, coinGeckoId) {
22
+ // TODO(felix): add this back
23
+ // invariant(!_.isUndefined(getBlockchainFromBlockchainId(chainId)), "CHAIN_ID");
24
+ super(decimals, symbol, name, url, false, true, coinGeckoId);
25
+ this.isNative = false;
26
+ this.isToken = true;
27
+ if (bypassChecksum) {
28
+ this.address = (0, validateAndParseAddress_js_1.checkValidAddress)(address)?.toLowerCase();
29
+ }
30
+ else {
31
+ this.address = (0, validateAndParseAddress_js_1.validateAndParseAddress)(address)?.toLowerCase();
32
+ }
33
+ this.chainId = chainId;
34
+ this.url = url;
35
+ }
36
+ static toSemiFungibleToken(sft) {
37
+ if (!sft) {
38
+ return undefined;
39
+ }
40
+ const currency = currency_js_1.Currency.toCurrency(sft.currency);
41
+ return new SemiFungibleToken(sft.chainId, sft.address, currency.decimals, currency.symbol, currency.name, sft.url);
42
+ }
43
+ /**
44
+ * Returns true if the two tokens are equivalent, i.e. have the same chainId and address.
45
+ * @param other other token to compare
46
+ */
47
+ equals(other) {
48
+ // short circuit on reference equality
49
+ if (this === other)
50
+ return true;
51
+ return (this.chainId === other.chainId &&
52
+ this.address === other.address.toLowerCase());
53
+ }
54
+ /**
55
+ * Returns the currency object that this token represents
56
+ */
57
+ currency() {
58
+ return this;
59
+ }
60
+ type() {
61
+ return enums_js_1.TokenType.SEMI_FUNGIBLE_TOKEN;
62
+ }
63
+ identifier() {
64
+ return `${this.chainId}+${this.address.toLowerCase()}`;
65
+ }
66
+ }
67
+ exports.SemiFungibleToken = SemiFungibleToken;
@@ -0,0 +1,8 @@
1
+ import { LIBRARY_TYPE } from "../enums.js";
2
+ export declare class LibraryRequest {
3
+ readonly library: LIBRARY_TYPE;
4
+ readonly client?: any;
5
+ readonly provider?: any;
6
+ constructor(library: LIBRARY_TYPE, client?: any, provider?: any);
7
+ sendRequest(method: string, params: any[]): Promise<any>;
8
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LibraryRequest = void 0;
7
+ const enums_js_1 = require("../enums.js");
8
+ const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
9
+ class LibraryRequest {
10
+ constructor(library, client, provider) {
11
+ if (library == enums_js_1.LIBRARY_TYPE.VIEM) {
12
+ (0, tiny_invariant_1.default)(client, "CLIENT");
13
+ (0, tiny_invariant_1.default)(!provider, "PROVIDER");
14
+ this.client = client;
15
+ }
16
+ else if (library == enums_js_1.LIBRARY_TYPE.ETHERS) {
17
+ (0, tiny_invariant_1.default)(provider, "PROVIDER");
18
+ (0, tiny_invariant_1.default)(!client, "CLIENT");
19
+ this.provider = provider;
20
+ }
21
+ else {
22
+ (0, tiny_invariant_1.default)(false, "LIBRARY");
23
+ }
24
+ this.library = library;
25
+ this.client = client;
26
+ this.provider = provider;
27
+ }
28
+ sendRequest(method, params) {
29
+ if (this.library == enums_js_1.LIBRARY_TYPE.VIEM) {
30
+ return this.client.request({ method, params });
31
+ }
32
+ else if (this.library == enums_js_1.LIBRARY_TYPE.ETHERS) {
33
+ return this.provider.send(method, params);
34
+ }
35
+ }
36
+ }
37
+ exports.LibraryRequest = LibraryRequest;
@@ -0,0 +1,22 @@
1
+ import { FungibleToken } from "./financial/fungible_token.js";
2
+ import { FungibleTokenAmount } from "./financial/fungible_token_amount.js";
3
+ import { NonFungibleToken } from "./financial/non_fungible_token.js";
4
+ import { SemiFungibleToken } from "./financial/semi_fungible_token.js";
5
+ export declare class State {
6
+ private readonly fungibleTokens;
7
+ private readonly nonFungibleTokens;
8
+ private readonly semiFungibleTokens;
9
+ constructor(fungibleTokens: FungibleTokenAmount[], nonFungibleTokens: NonFungibleToken[], semiFungibleTokens: SemiFungibleToken[]);
10
+ static fromFungibleTokenAmounts(fungibleTokenAmounts: FungibleTokenAmount[]): State;
11
+ static fromTokenAndAmount(token?: FungibleToken, amount?: bigint): State;
12
+ getFungibleTokens(): FungibleTokenAmount[];
13
+ getNonFungibleTokens(): NonFungibleToken[];
14
+ getSemiFungibleTokens(): SemiFungibleToken[];
15
+ addTokens(fungibleTokens: FungibleTokenAmount[]): State;
16
+ addState(other: State): State;
17
+ deductState(other: State): State;
18
+ equals(other?: State): boolean;
19
+ addStates(states: State[]): State;
20
+ static mergeStates(states: State[]): State;
21
+ static toState(state: any): State;
22
+ }
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.State = void 0;
4
+ const fungible_token_amount_js_1 = require("./financial/fungible_token_amount.js");
5
+ const non_fungible_token_js_1 = require("./financial/non_fungible_token.js");
6
+ const semi_fungible_token_js_1 = require("./financial/semi_fungible_token.js");
7
+ class State {
8
+ constructor(fungibleTokens, nonFungibleTokens, semiFungibleTokens) {
9
+ this.fungibleTokens = fungibleTokens.reduce((acc, amount) => {
10
+ acc.set(amount.token.identifier(), amount);
11
+ return acc;
12
+ }, new Map());
13
+ this.nonFungibleTokens = nonFungibleTokens.reduce((acc, token) => {
14
+ acc.set(token.identifier(), token);
15
+ return acc;
16
+ }, new Map());
17
+ this.semiFungibleTokens = semiFungibleTokens.reduce((acc, token) => {
18
+ acc.set(token.identifier(), token);
19
+ return acc;
20
+ }, new Map());
21
+ }
22
+ static fromFungibleTokenAmounts(fungibleTokenAmounts) {
23
+ return new State(fungibleTokenAmounts, [], []);
24
+ }
25
+ static fromTokenAndAmount(token, amount) {
26
+ if (!token || !amount) {
27
+ return undefined;
28
+ }
29
+ const fungibleTokenAmount = fungible_token_amount_js_1.FungibleTokenAmount.fromRawAmount(token, amount);
30
+ return State.fromFungibleTokenAmounts([fungibleTokenAmount]);
31
+ }
32
+ getFungibleTokens() {
33
+ return Array.from(this.fungibleTokens.values());
34
+ }
35
+ getNonFungibleTokens() {
36
+ return Array.from(this.nonFungibleTokens.values());
37
+ }
38
+ getSemiFungibleTokens() {
39
+ return Array.from(this.semiFungibleTokens.values());
40
+ }
41
+ addTokens(fungibleTokens) {
42
+ fungibleTokens.forEach((amount) => {
43
+ const identifier = amount.token.identifier();
44
+ const currentAmount = this.fungibleTokens.get(identifier);
45
+ if (currentAmount) {
46
+ this.fungibleTokens.set(identifier, currentAmount.add(amount));
47
+ }
48
+ else {
49
+ this.fungibleTokens.set(identifier, amount);
50
+ }
51
+ });
52
+ return this;
53
+ }
54
+ addState(other) {
55
+ other?.fungibleTokens?.forEach((amount) => {
56
+ const identifier = amount.token.identifier();
57
+ const currentAmount = this.fungibleTokens.get(identifier);
58
+ if (currentAmount) {
59
+ this.fungibleTokens.set(identifier, currentAmount.add(amount));
60
+ }
61
+ else {
62
+ this.fungibleTokens.set(identifier, amount);
63
+ }
64
+ });
65
+ return this;
66
+ }
67
+ deductState(other) {
68
+ other.fungibleTokens.forEach((amount) => {
69
+ const identifier = amount.token.identifier();
70
+ const currentAmount = this.fungibleTokens.get(identifier);
71
+ if (currentAmount?.toRawAmount() > amount?.toRawAmount()) {
72
+ this.fungibleTokens.set(identifier, currentAmount.subtract(amount));
73
+ }
74
+ else if (currentAmount) {
75
+ this.fungibleTokens.delete(identifier);
76
+ }
77
+ });
78
+ return this;
79
+ }
80
+ equals(other) {
81
+ if (!other) {
82
+ return false;
83
+ }
84
+ return (this.fungibleTokens.size == other.fungibleTokens.size &&
85
+ Array.from(this.fungibleTokens.entries()).every(([key, value]) => {
86
+ const otherValue = other.fungibleTokens.get(key);
87
+ return otherValue && value.equals(otherValue);
88
+ }));
89
+ }
90
+ addStates(states) {
91
+ states.forEach((state) => this.addState(state));
92
+ return this;
93
+ }
94
+ static mergeStates(states) {
95
+ return states.reduce((acc, state) => acc.addState(state), new State([], [], []));
96
+ }
97
+ static toState(state) {
98
+ if (!state)
99
+ return undefined;
100
+ const fungibleTokenAmounts = state.fungibleTokenAmounts.map((ft) => fungible_token_amount_js_1.FungibleTokenAmount.toFungibleTokenAmount(ft));
101
+ const nonFungibleTokenAmounts = state.nonFungibleTokenAmounts.map((nft) => non_fungible_token_js_1.NonFungibleToken.toNonFungibleToken(nft));
102
+ const semiFungibleTokenAmounts = state.semiFungibleTokenAmounts.map((sft) => semi_fungible_token_js_1.SemiFungibleToken.toSemiFungibleToken(sft));
103
+ return new State(fungibleTokenAmounts, nonFungibleTokenAmounts, semiFungibleTokenAmounts);
104
+ }
105
+ }
106
+ exports.State = State;
@@ -0,0 +1,116 @@
1
+ export declare enum Blockchain {
2
+ ETHEREUM = "ethereum",
3
+ POLYGON = "polygon",
4
+ BINANCE = "binance",
5
+ ARBITRUM = "arbitrum",
6
+ BASE = "base",
7
+ AVALANCHE = "avalanche",
8
+ ARBITRUM_NOVA = "arbitrum_nova",
9
+ OPTIMISM = "optimism",
10
+ EVMOS = "evmos",
11
+ MOONBEAM = "moonbeam",
12
+ ETHEREUM_SEPOLIA = "ethereum_sepolia",
13
+ ETHEREUM_HOLESKY = "ethereum_holesky",
14
+ BASE_SEPOLIA = "base_sepolia",
15
+ ARBITRUM_SEPOLIA = "arbitrum_sepolia",
16
+ OPTIMISM_SEPOLIA = "optimism_sepolia",
17
+ POLYGON_AMOY = "polygon_amoy",
18
+ BINANCE_TESTNET = "binance_testnet",
19
+ OPBNB_TESTNET = "opbnb_testnet",
20
+ MOONBEAM_ALPHA = "moonbeam_alpha",
21
+ HARDHAT = "hardhat",
22
+ LOCAL_CHAIN_0 = "local_chain_0",
23
+ LOCAL_CHAIN_1 = "local_chain_1"
24
+ }
25
+ export declare enum TokenType {
26
+ FUNGIBLE_TOKEN = "FUNGIBLE_TOKEN",
27
+ NON_FUNGIBLE_TOKEN = "NON_FUNGIBLE_TOKEN",
28
+ SEMI_FUNGIBLE_TOKEN = "SEMI_FUNGIBLE_TOKEN",
29
+ FIAT = "FIAT"
30
+ }
31
+ export declare enum AccountType {
32
+ EOA = "EOA",
33
+ SCA = "SCA"
34
+ }
35
+ export declare enum VMType {
36
+ EVM = "EVM"
37
+ }
38
+ export declare enum ChainSupportStatus {
39
+ CHAIN_SUPPORTED = "CHAIN_SUPPORTED",
40
+ CHAIN_UNAVAILABLE = "CHAIN_UNAVAILABLE",
41
+ ACCOUNT_UNAVAILABLE = "ACCOUNT_UNAVAILABLE"
42
+ }
43
+ export declare enum CreateOperationsStatus {
44
+ INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
45
+ INSUFFICIENT_FUNDS_FOR_GAS = "INSUFFICIENT_FUNDS_FOR_GAS",
46
+ INTERNAL = "INTERNAL",
47
+ INVALID_ARGUMENT = "INVALID_ARGUMENT",
48
+ NO_EXECUTION_PATH = "NO_EXECUTION_PATH",
49
+ SUCCESS = "SUCCESS"
50
+ }
51
+ export declare enum OperationDataFormat {
52
+ TRANSACTION = "TRANSACTION",
53
+ TYPED_DATA = "TYPED_DATA"
54
+ }
55
+ export declare enum OperationType {
56
+ APPROVE_ERC20_TOKEN = "APPROVE_ERC20_TOKEN",
57
+ CANCEL_OPERATION = "CANCEL_OPERATION",
58
+ CANCEL_TRANSACTION = "CANCEL_TRANSACTION",
59
+ FINAL_TRANSACTION = "FINAL_TRANSACTION",
60
+ GAS_ABSTRACTION = "GAS_ABSTRACTION",
61
+ NATIVE_TOKEN_TRANSFER = "NATIVE_TOKEN_TRANSFER",
62
+ SUBMIT_INTENT = "SUBMIT_INTENT"
63
+ }
64
+ export declare enum Category {
65
+ SEND = "SEND",
66
+ RECEIVE = "RECEIVE",
67
+ SWAP = "SWAP",
68
+ REBALANCE = "REBALANCE",
69
+ BRIDGE = "BRIDGE",
70
+ FUNCTION_CALL = "FUNCTION_CALL",
71
+ TYPED_DATA_SIGNATURE = "TYPED_DATA_SIGNATURE"
72
+ }
73
+ export declare enum OperationStatusType {
74
+ FAILED = "FAILED",
75
+ NOT_FOUND = "NOT_FOUND",
76
+ PENDING = "PENDING",
77
+ SUCCESSFUL = "SUCCESSFUL",
78
+ WAITING_PRECONDITION = "WAITING_PRECONDITION"
79
+ }
80
+ export declare enum QuoteType {
81
+ EXACT_INPUT = "EXACT_INPUT",
82
+ EXACT_OUTPUT = "EXACT_OUTPUT"
83
+ }
84
+ export declare enum Order {
85
+ NEWEST = "NEWEST",
86
+ OLDEST = "OLDEST"
87
+ }
88
+ export declare enum ActivityStatus {
89
+ CANCELLED = "CANCELLED",
90
+ FAILED = "FAILED",
91
+ PENDING = "PENDING",
92
+ SUCCESS = "SUCCESS"
93
+ }
94
+ export declare enum BlockchainEnvironment {
95
+ MAINNET = "MAINNET",
96
+ TESTNET = "TESTNET"
97
+ }
98
+ export declare enum TokenAllowlistType {
99
+ ALL_TOKENS = "ALL_TOKENS",
100
+ ONLY_FUNGIBLE_TOKENS = "ONLY_FUNGIBLE_TOKENS",
101
+ ONLY_NON_FUNGIBLE_TOKENS = "ONLY_NON_FUNGIBLE_TOKENS",
102
+ ONLY_SEMI_FUNGIBLE_TOKENS = "ONLY_SEMI_FUNGIBLE_TOKENS"
103
+ }
104
+ export declare enum TimeIntervalUnits {
105
+ DAYS = "DAYS",
106
+ FOREVER = "FOREVER",
107
+ HOURS = "HOURS",
108
+ MINUTES = "MINUTES",
109
+ MONTHS = "MONTHS",
110
+ WEEKS = "WEEKS",
111
+ YEARS = "YEARS"
112
+ }
113
+ export declare enum LIBRARY_TYPE {
114
+ VIEM = "VIEM",
115
+ ETHERS = "ETHERS"
116
+ }
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LIBRARY_TYPE = exports.TimeIntervalUnits = exports.TokenAllowlistType = exports.BlockchainEnvironment = exports.ActivityStatus = exports.Order = exports.QuoteType = exports.OperationStatusType = exports.Category = exports.OperationType = exports.OperationDataFormat = exports.CreateOperationsStatus = exports.ChainSupportStatus = exports.VMType = exports.AccountType = exports.TokenType = exports.Blockchain = void 0;
4
+ var Blockchain;
5
+ (function (Blockchain) {
6
+ Blockchain["ETHEREUM"] = "ethereum";
7
+ Blockchain["POLYGON"] = "polygon";
8
+ Blockchain["BINANCE"] = "binance";
9
+ Blockchain["ARBITRUM"] = "arbitrum";
10
+ Blockchain["BASE"] = "base";
11
+ Blockchain["AVALANCHE"] = "avalanche";
12
+ Blockchain["ARBITRUM_NOVA"] = "arbitrum_nova";
13
+ Blockchain["OPTIMISM"] = "optimism";
14
+ Blockchain["EVMOS"] = "evmos";
15
+ Blockchain["MOONBEAM"] = "moonbeam";
16
+ // testnets
17
+ Blockchain["ETHEREUM_SEPOLIA"] = "ethereum_sepolia";
18
+ Blockchain["ETHEREUM_HOLESKY"] = "ethereum_holesky";
19
+ Blockchain["BASE_SEPOLIA"] = "base_sepolia";
20
+ Blockchain["ARBITRUM_SEPOLIA"] = "arbitrum_sepolia";
21
+ Blockchain["OPTIMISM_SEPOLIA"] = "optimism_sepolia";
22
+ Blockchain["POLYGON_AMOY"] = "polygon_amoy";
23
+ Blockchain["BINANCE_TESTNET"] = "binance_testnet";
24
+ Blockchain["OPBNB_TESTNET"] = "opbnb_testnet";
25
+ Blockchain["MOONBEAM_ALPHA"] = "moonbeam_alpha";
26
+ // local testing
27
+ Blockchain["HARDHAT"] = "hardhat";
28
+ Blockchain["LOCAL_CHAIN_0"] = "local_chain_0";
29
+ Blockchain["LOCAL_CHAIN_1"] = "local_chain_1";
30
+ })(Blockchain || (exports.Blockchain = Blockchain = {}));
31
+ var TokenType;
32
+ (function (TokenType) {
33
+ TokenType["FUNGIBLE_TOKEN"] = "FUNGIBLE_TOKEN";
34
+ TokenType["NON_FUNGIBLE_TOKEN"] = "NON_FUNGIBLE_TOKEN";
35
+ TokenType["SEMI_FUNGIBLE_TOKEN"] = "SEMI_FUNGIBLE_TOKEN";
36
+ TokenType["FIAT"] = "FIAT";
37
+ })(TokenType || (exports.TokenType = TokenType = {}));
38
+ var AccountType;
39
+ (function (AccountType) {
40
+ AccountType["EOA"] = "EOA";
41
+ AccountType["SCA"] = "SCA";
42
+ })(AccountType || (exports.AccountType = AccountType = {}));
43
+ var VMType;
44
+ (function (VMType) {
45
+ VMType["EVM"] = "EVM";
46
+ })(VMType || (exports.VMType = VMType = {}));
47
+ var ChainSupportStatus;
48
+ (function (ChainSupportStatus) {
49
+ ChainSupportStatus["CHAIN_SUPPORTED"] = "CHAIN_SUPPORTED";
50
+ ChainSupportStatus["CHAIN_UNAVAILABLE"] = "CHAIN_UNAVAILABLE";
51
+ ChainSupportStatus["ACCOUNT_UNAVAILABLE"] = "ACCOUNT_UNAVAILABLE";
52
+ })(ChainSupportStatus || (exports.ChainSupportStatus = ChainSupportStatus = {}));
53
+ var CreateOperationsStatus;
54
+ (function (CreateOperationsStatus) {
55
+ CreateOperationsStatus["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
56
+ CreateOperationsStatus["INSUFFICIENT_FUNDS_FOR_GAS"] = "INSUFFICIENT_FUNDS_FOR_GAS";
57
+ CreateOperationsStatus["INTERNAL"] = "INTERNAL";
58
+ CreateOperationsStatus["INVALID_ARGUMENT"] = "INVALID_ARGUMENT";
59
+ CreateOperationsStatus["NO_EXECUTION_PATH"] = "NO_EXECUTION_PATH";
60
+ CreateOperationsStatus["SUCCESS"] = "SUCCESS";
61
+ })(CreateOperationsStatus || (exports.CreateOperationsStatus = CreateOperationsStatus = {}));
62
+ var OperationDataFormat;
63
+ (function (OperationDataFormat) {
64
+ OperationDataFormat["TRANSACTION"] = "TRANSACTION";
65
+ OperationDataFormat["TYPED_DATA"] = "TYPED_DATA";
66
+ })(OperationDataFormat || (exports.OperationDataFormat = OperationDataFormat = {}));
67
+ var OperationType;
68
+ (function (OperationType) {
69
+ OperationType["APPROVE_ERC20_TOKEN"] = "APPROVE_ERC20_TOKEN";
70
+ OperationType["CANCEL_OPERATION"] = "CANCEL_OPERATION";
71
+ OperationType["CANCEL_TRANSACTION"] = "CANCEL_TRANSACTION";
72
+ OperationType["FINAL_TRANSACTION"] = "FINAL_TRANSACTION";
73
+ OperationType["GAS_ABSTRACTION"] = "GAS_ABSTRACTION";
74
+ OperationType["NATIVE_TOKEN_TRANSFER"] = "NATIVE_TOKEN_TRANSFER";
75
+ OperationType["SUBMIT_INTENT"] = "SUBMIT_INTENT";
76
+ })(OperationType || (exports.OperationType = OperationType = {}));
77
+ var Category;
78
+ (function (Category) {
79
+ Category["SEND"] = "SEND";
80
+ Category["RECEIVE"] = "RECEIVE";
81
+ Category["SWAP"] = "SWAP";
82
+ Category["REBALANCE"] = "REBALANCE";
83
+ Category["BRIDGE"] = "BRIDGE";
84
+ Category["FUNCTION_CALL"] = "FUNCTION_CALL";
85
+ Category["TYPED_DATA_SIGNATURE"] = "TYPED_DATA_SIGNATURE";
86
+ })(Category || (exports.Category = Category = {}));
87
+ var OperationStatusType;
88
+ (function (OperationStatusType) {
89
+ OperationStatusType["FAILED"] = "FAILED";
90
+ OperationStatusType["NOT_FOUND"] = "NOT_FOUND";
91
+ OperationStatusType["PENDING"] = "PENDING";
92
+ OperationStatusType["SUCCESSFUL"] = "SUCCESSFUL";
93
+ OperationStatusType["WAITING_PRECONDITION"] = "WAITING_PRECONDITION";
94
+ })(OperationStatusType || (exports.OperationStatusType = OperationStatusType = {}));
95
+ var QuoteType;
96
+ (function (QuoteType) {
97
+ QuoteType["EXACT_INPUT"] = "EXACT_INPUT";
98
+ QuoteType["EXACT_OUTPUT"] = "EXACT_OUTPUT";
99
+ })(QuoteType || (exports.QuoteType = QuoteType = {}));
100
+ var Order;
101
+ (function (Order) {
102
+ Order["NEWEST"] = "NEWEST";
103
+ Order["OLDEST"] = "OLDEST";
104
+ })(Order || (exports.Order = Order = {}));
105
+ var ActivityStatus;
106
+ (function (ActivityStatus) {
107
+ ActivityStatus["CANCELLED"] = "CANCELLED";
108
+ ActivityStatus["FAILED"] = "FAILED";
109
+ ActivityStatus["PENDING"] = "PENDING";
110
+ ActivityStatus["SUCCESS"] = "SUCCESS";
111
+ })(ActivityStatus || (exports.ActivityStatus = ActivityStatus = {}));
112
+ var BlockchainEnvironment;
113
+ (function (BlockchainEnvironment) {
114
+ BlockchainEnvironment["MAINNET"] = "MAINNET";
115
+ BlockchainEnvironment["TESTNET"] = "TESTNET";
116
+ })(BlockchainEnvironment || (exports.BlockchainEnvironment = BlockchainEnvironment = {}));
117
+ var TokenAllowlistType;
118
+ (function (TokenAllowlistType) {
119
+ TokenAllowlistType["ALL_TOKENS"] = "ALL_TOKENS";
120
+ TokenAllowlistType["ONLY_FUNGIBLE_TOKENS"] = "ONLY_FUNGIBLE_TOKENS";
121
+ TokenAllowlistType["ONLY_NON_FUNGIBLE_TOKENS"] = "ONLY_NON_FUNGIBLE_TOKENS";
122
+ TokenAllowlistType["ONLY_SEMI_FUNGIBLE_TOKENS"] = "ONLY_SEMI_FUNGIBLE_TOKENS";
123
+ })(TokenAllowlistType || (exports.TokenAllowlistType = TokenAllowlistType = {}));
124
+ var TimeIntervalUnits;
125
+ (function (TimeIntervalUnits) {
126
+ TimeIntervalUnits["DAYS"] = "DAYS";
127
+ TimeIntervalUnits["FOREVER"] = "FOREVER";
128
+ TimeIntervalUnits["HOURS"] = "HOURS";
129
+ TimeIntervalUnits["MINUTES"] = "MINUTES";
130
+ TimeIntervalUnits["MONTHS"] = "MONTHS";
131
+ TimeIntervalUnits["WEEKS"] = "WEEKS";
132
+ TimeIntervalUnits["YEARS"] = "YEARS";
133
+ })(TimeIntervalUnits || (exports.TimeIntervalUnits = TimeIntervalUnits = {}));
134
+ var LIBRARY_TYPE;
135
+ (function (LIBRARY_TYPE) {
136
+ LIBRARY_TYPE["VIEM"] = "VIEM";
137
+ LIBRARY_TYPE["ETHERS"] = "ETHERS";
138
+ })(LIBRARY_TYPE || (exports.LIBRARY_TYPE = LIBRARY_TYPE = {}));
@@ -0,0 +1,29 @@
1
+ export * from "./interfaces/account_cluster.js";
2
+ export * from "./interfaces/admin.js";
3
+ export * from "./interfaces/application.js";
4
+ export * from "./interfaces/instance.js";
5
+ export * from "./interfaces/operation.js";
6
+ export * from "./interfaces/token.js";
7
+ export * from "./interfaces/orby.js";
8
+ export * from "./interfaces/blockchain.js";
9
+ export * from "./actions/account_cluster.js";
10
+ export * from "./actions/admin.js";
11
+ export * from "./actions/application.js";
12
+ export * from "./actions/instance.js";
13
+ export * from "./actions/operation.js";
14
+ export * from "./actions/token.js";
15
+ export * from "./actions/blockchain.js";
16
+ export * from "./entities/financial/account_balance.js";
17
+ export * from "./entities/financial/asset.js";
18
+ export * from "./entities/financial/currency_amount.js";
19
+ export * from "./entities/financial/currency.js";
20
+ export * from "./entities/financial/fungible_token_amount.js";
21
+ export * from "./entities/financial/fungible_token.js";
22
+ export * from "./entities/financial/non_fungible_token.js";
23
+ export * from "./entities/financial/semi_fungible_token.js";
24
+ export * from "./entities/account.js";
25
+ export * from "./entities/state.js";
26
+ export * from "./enums.js";
27
+ export * from "./types.js";
28
+ export * from "./constants.js";
29
+ export * from "./utils/utils.js";
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // interfaces
18
+ __exportStar(require("./interfaces/account_cluster.js"), exports);
19
+ __exportStar(require("./interfaces/admin.js"), exports);
20
+ __exportStar(require("./interfaces/application.js"), exports);
21
+ __exportStar(require("./interfaces/instance.js"), exports);
22
+ __exportStar(require("./interfaces/operation.js"), exports);
23
+ __exportStar(require("./interfaces/token.js"), exports);
24
+ __exportStar(require("./interfaces/orby.js"), exports);
25
+ __exportStar(require("./interfaces/blockchain.js"), exports);
26
+ // actions
27
+ __exportStar(require("./actions/account_cluster.js"), exports);
28
+ __exportStar(require("./actions/admin.js"), exports);
29
+ __exportStar(require("./actions/application.js"), exports);
30
+ __exportStar(require("./actions/instance.js"), exports);
31
+ __exportStar(require("./actions/operation.js"), exports);
32
+ __exportStar(require("./actions/token.js"), exports);
33
+ __exportStar(require("./actions/blockchain.js"), exports);
34
+ // entities
35
+ __exportStar(require("./entities/financial/account_balance.js"), exports);
36
+ __exportStar(require("./entities/financial/asset.js"), exports);
37
+ __exportStar(require("./entities/financial/currency_amount.js"), exports);
38
+ __exportStar(require("./entities/financial/currency.js"), exports);
39
+ __exportStar(require("./entities/financial/fungible_token_amount.js"), exports);
40
+ __exportStar(require("./entities/financial/fungible_token.js"), exports);
41
+ __exportStar(require("./entities/financial/non_fungible_token.js"), exports);
42
+ __exportStar(require("./entities/financial/semi_fungible_token.js"), exports);
43
+ __exportStar(require("./entities/account.js"), exports);
44
+ __exportStar(require("./entities/state.js"), exports);
45
+ // enums, types and constants
46
+ __exportStar(require("./enums.js"), exports);
47
+ __exportStar(require("./types.js"), exports);
48
+ __exportStar(require("./constants.js"), exports);
49
+ __exportStar(require("./utils/utils.js"), exports);
@@ -0,0 +1,30 @@
1
+ import { Account } from "../entities/account.js";
2
+ import { AccountCluster, Activity, ChainEndpoint, FungibleTokenOverview, StandardizedBalance, VirtualNodeRpcUrlForSupportedChain } from "../types.js";
3
+ import { ChainSupportStatus, Order } from "../enums.js";
4
+ export interface IAccountClusterActions {
5
+ createAccountCluster(accounts: Account[]): Promise<AccountCluster>;
6
+ addToAccountCluster(accounts: Account[], accountClusterId: string): Promise<AccountCluster>;
7
+ removeFromAccountCluster(accounts: Account[], accountClusterId: string): Promise<AccountCluster>;
8
+ getVirtualNodeRpcUrlsForSupportedChains(accountClusterId: string): Promise<VirtualNodeRpcUrlForSupportedChain[]>;
9
+ enableChainAbstractionForAccountCluster(accountClusterId: string, enable: boolean): Promise<boolean>;
10
+ setCustomChainEndpointsForAccountCluster(accountClusterId: string, chainEndpoints: ChainEndpoint[]): Promise<boolean>;
11
+ removeCustomChainEndpointsForAccountCluster(accountClusterId: string, chainIds: bigint[]): Promise<boolean>;
12
+ getCustomChainEndpointsForAccountCluster(accountClusterId: string, returnChainIdsOnly: boolean): Promise<ChainEndpoint[]>;
13
+ isChainSupportedOnAccountCluster(accountClusterId: string, chainId: bigint): Promise<ChainSupportStatus>;
14
+ getNodeRpcUrl(accountClusterId: string, chainId: bigint): Promise<string>;
15
+ getVirtualNodeRpcUrl(accountClusterId: string, chainId: bigint, entrypointAccountAddress: string): Promise<string>;
16
+ getActivity(accountClusterId: string, limit?: number, offset?: number, order?: Order, startDate?: number, endDate?: number, filters?: {
17
+ transactionHash?: string;
18
+ address?: string;
19
+ }[]): Promise<{
20
+ activities: Activity[];
21
+ pageInfo: {
22
+ hasNextPage: boolean;
23
+ hasPreviousPage: boolean;
24
+ totalCount: number;
25
+ };
26
+ }>;
27
+ getPortfolioOverview(accountClusterId: string): Promise<FungibleTokenOverview>;
28
+ getFungibleTokenPortfolio(accountClusterId: string): Promise<StandardizedBalance[]>;
29
+ getFungibleTokenBalances(accountClusterId: string, offset?: number, limit?: number, chainId?: bigint, tokensToOmit?: string[]): Promise<StandardizedBalance[]>;
30
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });