@orb-labs/orby-core 0.0.14 → 0.0.16
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.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/actions/account_cluster.js +211 -0
- package/dist/cjs/actions/admin.js +43 -0
- package/dist/cjs/actions/application.js +20 -0
- package/dist/cjs/actions/blockchain.js +39 -0
- package/dist/cjs/actions/instance.js +98 -0
- package/dist/{actions → cjs/actions}/operation.d.ts +2 -2
- package/dist/cjs/actions/operation.js +415 -0
- package/dist/cjs/actions/token.js +50 -0
- package/dist/cjs/constants.js +139 -0
- package/dist/cjs/entities/account.js +49 -0
- package/dist/cjs/entities/financial/account_balance.js +35 -0
- package/dist/cjs/entities/financial/asset.js +42 -0
- package/dist/cjs/entities/financial/currency.js +56 -0
- package/dist/cjs/entities/financial/currency_amount.js +99 -0
- package/dist/cjs/entities/financial/fungible_token.js +68 -0
- package/dist/cjs/entities/financial/fungible_token_amount.js +102 -0
- package/dist/cjs/entities/financial/non_fungible_token.js +65 -0
- package/dist/cjs/entities/financial/semi_fungible_token.js +67 -0
- package/dist/cjs/entities/library_request.js +37 -0
- package/dist/cjs/entities/state.js +106 -0
- package/dist/cjs/enums.js +138 -0
- package/dist/cjs/index.js +49 -0
- package/dist/cjs/interfaces/account_cluster.js +2 -0
- package/dist/cjs/interfaces/admin.js +2 -0
- package/dist/cjs/interfaces/application.js +2 -0
- package/dist/cjs/interfaces/blockchain.js +2 -0
- package/dist/cjs/interfaces/instance.js +2 -0
- package/dist/{interfaces → cjs/interfaces}/operation.d.ts +2 -2
- package/dist/cjs/interfaces/operation.js +2 -0
- package/dist/cjs/interfaces/orby.js +2 -0
- package/dist/cjs/interfaces/token.js +2 -0
- package/dist/{types.d.ts → cjs/types.d.ts} +20 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils/action_helpers.js +274 -0
- package/dist/cjs/utils/utils.js +79 -0
- package/dist/cjs/utils/validateAndParseAddress.js +29 -0
- package/dist/esm/actions/account_cluster.d.ts +32 -0
- package/dist/esm/actions/admin.d.ts +17 -0
- package/dist/esm/actions/application.d.ts +6 -0
- package/dist/esm/actions/blockchain.d.ts +16 -0
- package/dist/esm/actions/instance.d.ts +15 -0
- package/dist/esm/actions/operation.d.ts +99 -0
- package/dist/{actions → esm/actions}/operation.js +75 -5
- package/dist/esm/actions/token.d.ts +15 -0
- package/dist/{actions → esm/actions}/token.js +1 -1
- package/dist/esm/constants.d.ts +14 -0
- package/dist/esm/entities/account.d.ts +14 -0
- package/dist/{entities → esm/entities}/account.js +1 -1
- package/dist/esm/entities/financial/account_balance.d.ts +12 -0
- package/dist/esm/entities/financial/asset.d.ts +31 -0
- package/dist/esm/entities/financial/currency.d.ts +41 -0
- package/dist/esm/entities/financial/currency_amount.d.ts +34 -0
- package/dist/esm/entities/financial/fungible_token.d.ts +41 -0
- package/dist/esm/entities/financial/fungible_token_amount.d.ts +36 -0
- package/dist/esm/entities/financial/non_fungible_token.d.ts +39 -0
- package/dist/esm/entities/financial/semi_fungible_token.d.ts +41 -0
- package/dist/esm/entities/library_request.d.ts +8 -0
- package/dist/esm/entities/state.d.ts +22 -0
- package/dist/esm/enums.d.ts +116 -0
- package/dist/esm/index.d.ts +29 -0
- package/dist/esm/interfaces/account_cluster.d.ts +30 -0
- package/dist/esm/interfaces/admin.d.ts +14 -0
- package/dist/esm/interfaces/application.d.ts +3 -0
- package/dist/esm/interfaces/blockchain.d.ts +13 -0
- package/dist/esm/interfaces/instance.d.ts +12 -0
- package/dist/esm/interfaces/operation.d.ts +97 -0
- package/dist/esm/interfaces/orby.d.ts +9 -0
- package/dist/esm/interfaces/token.d.ts +12 -0
- package/dist/esm/types.d.ts +172 -0
- package/dist/esm/utils/action_helpers.d.ts +22 -0
- package/dist/esm/utils/utils.d.ts +10 -0
- package/dist/esm/utils/validateAndParseAddress.d.ts +10 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +16 -7
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/dist/{actions → cjs/actions}/account_cluster.d.ts +0 -0
- /package/dist/{actions → cjs/actions}/admin.d.ts +0 -0
- /package/dist/{actions → cjs/actions}/application.d.ts +0 -0
- /package/dist/{actions → cjs/actions}/blockchain.d.ts +0 -0
- /package/dist/{actions → cjs/actions}/instance.d.ts +0 -0
- /package/dist/{actions → cjs/actions}/token.d.ts +0 -0
- /package/dist/{constants.d.ts → cjs/constants.d.ts} +0 -0
- /package/dist/{entities → cjs/entities}/account.d.ts +0 -0
- /package/dist/{entities → cjs/entities}/financial/account_balance.d.ts +0 -0
- /package/dist/{entities → cjs/entities}/financial/asset.d.ts +0 -0
- /package/dist/{entities → cjs/entities}/financial/currency.d.ts +0 -0
- /package/dist/{entities → cjs/entities}/financial/currency_amount.d.ts +0 -0
- /package/dist/{entities → cjs/entities}/financial/fungible_token.d.ts +0 -0
- /package/dist/{entities → cjs/entities}/financial/fungible_token_amount.d.ts +0 -0
- /package/dist/{entities → cjs/entities}/financial/non_fungible_token.d.ts +0 -0
- /package/dist/{entities → cjs/entities}/financial/semi_fungible_token.d.ts +0 -0
- /package/dist/{entities → cjs/entities}/library_request.d.ts +0 -0
- /package/dist/{entities → cjs/entities}/state.d.ts +0 -0
- /package/dist/{enums.d.ts → cjs/enums.d.ts} +0 -0
- /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/dist/{interfaces → cjs/interfaces}/account_cluster.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/admin.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/application.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/blockchain.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/instance.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/orby.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/token.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/action_helpers.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/utils.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/validateAndParseAddress.d.ts +0 -0
- /package/dist/{actions → esm/actions}/account_cluster.js +0 -0
- /package/dist/{actions → esm/actions}/admin.js +0 -0
- /package/dist/{actions → esm/actions}/application.js +0 -0
- /package/dist/{actions → esm/actions}/blockchain.js +0 -0
- /package/dist/{actions → esm/actions}/instance.js +0 -0
- /package/dist/{constants.js → esm/constants.js} +0 -0
- /package/dist/{entities → esm/entities}/financial/account_balance.js +0 -0
- /package/dist/{entities → esm/entities}/financial/asset.js +0 -0
- /package/dist/{entities → esm/entities}/financial/currency.js +0 -0
- /package/dist/{entities → esm/entities}/financial/currency_amount.js +0 -0
- /package/dist/{entities → esm/entities}/financial/fungible_token.js +0 -0
- /package/dist/{entities → esm/entities}/financial/fungible_token_amount.js +0 -0
- /package/dist/{entities → esm/entities}/financial/non_fungible_token.js +0 -0
- /package/dist/{entities → esm/entities}/financial/semi_fungible_token.js +0 -0
- /package/dist/{entities → esm/entities}/library_request.js +0 -0
- /package/dist/{entities → esm/entities}/state.js +0 -0
- /package/dist/{enums.js → esm/enums.js} +0 -0
- /package/dist/{index.js → esm/index.js} +0 -0
- /package/dist/{interfaces → esm/interfaces}/account_cluster.js +0 -0
- /package/dist/{interfaces → esm/interfaces}/admin.js +0 -0
- /package/dist/{interfaces → esm/interfaces}/application.js +0 -0
- /package/dist/{interfaces → esm/interfaces}/blockchain.js +0 -0
- /package/dist/{interfaces → esm/interfaces}/instance.js +0 -0
- /package/dist/{interfaces → esm/interfaces}/operation.js +0 -0
- /package/dist/{interfaces → esm/interfaces}/orby.js +0 -0
- /package/dist/{interfaces → esm/interfaces}/token.js +0 -0
- /package/dist/{types.js → esm/types.js} +0 -0
- /package/dist/{utils → esm/utils}/action_helpers.js +0 -0
- /package/dist/{utils → esm/utils}/utils.js +0 -0
- /package/dist/{utils → esm/utils}/validateAndParseAddress.js +0 -0
@@ -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,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,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,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,14 @@
|
|
1
|
+
import { GasSpendForInstance, GasSponsorshipData } from "../types.js";
|
2
|
+
export interface IAdminActions {
|
3
|
+
createInstance(name: string): Promise<{
|
4
|
+
success: boolean;
|
5
|
+
orbyInstancePrivateUrl: string;
|
6
|
+
orbyInstancePublicUrl: string;
|
7
|
+
}>;
|
8
|
+
getInstanceUrls(name: string): Promise<{
|
9
|
+
orbyInstancePrivateUrl: string;
|
10
|
+
orbyInstancePublicUrl: string;
|
11
|
+
}>;
|
12
|
+
getGasSpentForCustomer(month: string, year: string): Promise<GasSponsorshipData>;
|
13
|
+
getGasSpentForInstances(month: string, year: string, instanceNames: string[]): Promise<GasSpendForInstance[]>;
|
14
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { BlockchainInformation } from "../types.js";
|
2
|
+
export interface IBlockchainActions {
|
3
|
+
getBlockchainInformation(chainId: bigint): Promise<BlockchainInformation>;
|
4
|
+
listBlockchainsInformation(offset?: number, limit?: number): Promise<{
|
5
|
+
blockchains: BlockchainInformation[];
|
6
|
+
pageInfo: {
|
7
|
+
hasNextPage: boolean;
|
8
|
+
hasPreviousPage: boolean;
|
9
|
+
totalCount: number;
|
10
|
+
};
|
11
|
+
}>;
|
12
|
+
getChainsSupportedByDefault(chainId: bigint): Promise<BlockchainInformation[]>;
|
13
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { ChainEndpoint, GasSponsorshipPolicy } from "../types.js";
|
2
|
+
export interface IInstanceActions {
|
3
|
+
setCustomChainEndpointsForInstance(chainEndpoints: ChainEndpoint[]): Promise<boolean>;
|
4
|
+
removeCustomChainEndpointForInstance(chainIds: bigint[]): Promise<boolean>;
|
5
|
+
getCustomChainEndpointsForInstance(returnChainIdsOnly: boolean): Promise<boolean>;
|
6
|
+
enableChainAbstractionForInstance(enable: boolean): Promise<boolean>;
|
7
|
+
enableGasSponsorshipForInstance(enable: boolean): Promise<boolean>;
|
8
|
+
getGasSponsorForInstance(): Promise<string>;
|
9
|
+
getOrbyGasSponsorPolicyForInstance(): Promise<GasSponsorshipPolicy>;
|
10
|
+
setOrbyGasSponsorPolicyForInstance(gasSponsorshipPolicy: GasSponsorshipPolicy): Promise<boolean>;
|
11
|
+
removeOrbyGasSponsorPolicyForInstance(): Promise<boolean>;
|
12
|
+
}
|
@@ -0,0 +1,97 @@
|
|
1
|
+
import { AccountCluster, OnchainOperation, OperationSet, OperationStatus, SignedOperation, UserOperation } from "../types.js";
|
2
|
+
import { CurrencyAmount } from "../entities/financial/currency_amount.js";
|
3
|
+
import { OperationStatusType, QuoteType } from "../enums.js";
|
4
|
+
export interface IOperationActions {
|
5
|
+
getOperationsToExecuteTransaction(accountClusterId: string, to: string, data: string, value?: bigint, gasToken?: {
|
6
|
+
standardizedTokenId: string;
|
7
|
+
tokenSources?: {
|
8
|
+
chainId: bigint;
|
9
|
+
address?: string;
|
10
|
+
}[];
|
11
|
+
}): Promise<OperationSet>;
|
12
|
+
getOperationsToSignTypedData(accountClusterId: string, data: string, gasToken?: {
|
13
|
+
standardizedTokenId: string;
|
14
|
+
tokenSources?: {
|
15
|
+
chainId: bigint;
|
16
|
+
address?: string;
|
17
|
+
}[];
|
18
|
+
}): Promise<OperationSet>;
|
19
|
+
getOperationsToCancelTransaction(accountClusterId: string, operationSetId: string): Promise<OperationSet>;
|
20
|
+
isTransactionPreconditionSatisfied(accountClusterId: string, to: string, data: string, value?: bigint): Promise<boolean>;
|
21
|
+
isTypedDataPreconditionSatisfied(accountClusterId: string, data: string): Promise<boolean>;
|
22
|
+
sendSignedOperations(accountClusterId: string, signedOperations: SignedOperation[]): Promise<{
|
23
|
+
operationSetId: string;
|
24
|
+
operationResponses: OperationStatus[];
|
25
|
+
}>;
|
26
|
+
getOperationStatuses(operationIds: string[]): Promise<OperationStatus[]>;
|
27
|
+
estimateFiatCostToExecuteTransaction(to: string, data: string, value?: bigint): Promise<CurrencyAmount>;
|
28
|
+
estimateFiatCostToSignTypedData(data: string): Promise<CurrencyAmount>;
|
29
|
+
getOperationsToTransferToken(accountClusterId: string, standardizedTokenId: string, amount: bigint, recipient: {
|
30
|
+
chainId: bigint;
|
31
|
+
recipientAddress: string;
|
32
|
+
}, gasToken?: {
|
33
|
+
standardizedTokenId: string;
|
34
|
+
tokenSources?: {
|
35
|
+
chainId: bigint;
|
36
|
+
address?: string;
|
37
|
+
}[];
|
38
|
+
}): Promise<OperationSet>;
|
39
|
+
getOperationsToSwap(accountClusterId: string, swapType: QuoteType, input: {
|
40
|
+
standardizedTokenId: string;
|
41
|
+
amount?: bigint;
|
42
|
+
tokenSources?: {
|
43
|
+
chainId: bigint;
|
44
|
+
address?: string;
|
45
|
+
}[];
|
46
|
+
}, output: {
|
47
|
+
standardizedTokenId: string;
|
48
|
+
amount?: bigint;
|
49
|
+
tokenDestination?: {
|
50
|
+
chainId: bigint;
|
51
|
+
address?: string;
|
52
|
+
};
|
53
|
+
}, gasToken?: {
|
54
|
+
standardizedTokenId: string;
|
55
|
+
tokenSources?: {
|
56
|
+
chainId: bigint;
|
57
|
+
address?: string;
|
58
|
+
}[];
|
59
|
+
}): Promise<OperationSet>;
|
60
|
+
getQuote(accountClusterId: string, swapType: QuoteType, input: {
|
61
|
+
standardizedTokenId: string;
|
62
|
+
amount?: bigint;
|
63
|
+
tokenSources?: {
|
64
|
+
chainId: bigint;
|
65
|
+
address?: string;
|
66
|
+
}[];
|
67
|
+
}, output: {
|
68
|
+
standardizedTokenId: string;
|
69
|
+
amount?: bigint;
|
70
|
+
tokenDestination?: {
|
71
|
+
chainId: bigint;
|
72
|
+
address?: string;
|
73
|
+
};
|
74
|
+
}): Promise<OperationSet>;
|
75
|
+
getOperationsToBridge(accountClusterId: string, standardizedTokenId: string, amount: bigint, tokenSources?: {
|
76
|
+
chainId: bigint;
|
77
|
+
address?: string;
|
78
|
+
}[], tokenDestination?: {
|
79
|
+
chainId: bigint;
|
80
|
+
address?: string;
|
81
|
+
}, gasToken?: {
|
82
|
+
standardizedTokenId: string;
|
83
|
+
tokenSources?: {
|
84
|
+
chainId: bigint;
|
85
|
+
address?: string;
|
86
|
+
}[];
|
87
|
+
}): Promise<OperationSet>;
|
88
|
+
subscribeToOperationStatuses(ids?: string[], onOperationStatusesUpdateCallback?: (statusSummary: OperationStatusType, primaryOperationStatus?: OperationStatus, allOperationStatuses?: OperationStatus[]) => void, timout?: number): {
|
89
|
+
intervalId: NodeJS.Timeout | null;
|
90
|
+
};
|
91
|
+
sendOperationSet(accountCluster: AccountCluster, operationSet: OperationSet, signTransaction: (operation: OnchainOperation) => Promise<string | undefined>, signUserOperation: (operations: OnchainOperation[], accountAddress: string, chainId: bigint, txRpcUrl: string) => Promise<UserOperation | undefined>, signTypedData: (operation: OnchainOperation) => Promise<string | undefined>): Promise<{
|
92
|
+
success: boolean;
|
93
|
+
operationSetId?: string;
|
94
|
+
primaryOperationStatus?: OperationStatus;
|
95
|
+
operationResponses?: OperationStatus[];
|
96
|
+
}>;
|
97
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { IAccountClusterActions } from "./account_cluster.js";
|
2
|
+
import { IAdminActions } from "./admin.js";
|
3
|
+
import { IApplicationActions } from "./application.js";
|
4
|
+
import { IBlockchainActions } from "./blockchain.js";
|
5
|
+
import { IInstanceActions } from "./instance.js";
|
6
|
+
import { IOperationActions } from "./operation.js";
|
7
|
+
import { ITokenActions } from "./token.js";
|
8
|
+
export interface Orby extends IAccountClusterActions, IAdminActions, IApplicationActions, IInstanceActions, IOperationActions, ITokenActions, IBlockchainActions {
|
9
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { StandardizedToken } from "../types.js";
|
2
|
+
export interface ITokenActions {
|
3
|
+
getStandardizedTokenIds(tokens: {
|
4
|
+
tokenAddress: string;
|
5
|
+
chainId: bigint;
|
6
|
+
}[]): Promise<string[]>;
|
7
|
+
getStandardizedTokens(tokens: {
|
8
|
+
tokenAddress: string;
|
9
|
+
chainId: bigint;
|
10
|
+
}[]): Promise<StandardizedToken[]>;
|
11
|
+
getFungibleTokenData(standardizedTokenIds: string[]): Promise<StandardizedToken[]>;
|
12
|
+
}
|
@@ -0,0 +1,172 @@
|
|
1
|
+
import { Account } from "./entities/account.js";
|
2
|
+
import { Currency } from "./entities/financial/currency.js";
|
3
|
+
import { CurrencyAmount } from "./entities/financial/currency_amount.js";
|
4
|
+
import { FungibleToken } from "./entities/financial/fungible_token.js";
|
5
|
+
import { FungibleTokenAmount } from "./entities/financial/fungible_token_amount.js";
|
6
|
+
import { State } from "./entities/state.js";
|
7
|
+
import { ActivityStatus, BlockchainEnvironment, Category, CreateOperationsStatus, OperationDataFormat, OperationStatusType, OperationType, TimeIntervalUnits, TokenAllowlistType } from "./enums.js";
|
8
|
+
export type AccountCluster = {
|
9
|
+
accountClusterId: string;
|
10
|
+
accounts: Account[];
|
11
|
+
};
|
12
|
+
export type ChainEndpoint = {
|
13
|
+
chainId: bigint;
|
14
|
+
customRpcUrls?: string[];
|
15
|
+
customIndexerUrls?: string[];
|
16
|
+
};
|
17
|
+
export interface OperationSet {
|
18
|
+
status: CreateOperationsStatus;
|
19
|
+
primaryOperation?: OnchainOperation;
|
20
|
+
primaryOperationPreconditions?: State;
|
21
|
+
inputState?: State;
|
22
|
+
outputState?: State;
|
23
|
+
intents?: Intent[];
|
24
|
+
aggregateNetworkFeeInFiatCurrency?: CurrencyAmount;
|
25
|
+
aggregateOperationFeeInFiatCurrency?: CurrencyAmount;
|
26
|
+
aggregateEstimatedTimeInMs?: number;
|
27
|
+
}
|
28
|
+
export type Intent = {
|
29
|
+
estimatedProtocolFees?: FungibleTokenAmount;
|
30
|
+
estimatedProtocolFeesInFiatCurrency?: CurrencyAmount;
|
31
|
+
inputState?: State;
|
32
|
+
intentOperations?: OnchainOperation[];
|
33
|
+
outputState?: State;
|
34
|
+
};
|
35
|
+
export type UserOperation = {
|
36
|
+
sender: string;
|
37
|
+
nonce: string;
|
38
|
+
factory: string;
|
39
|
+
factoryData: string;
|
40
|
+
callData: string;
|
41
|
+
callGasLimit: string;
|
42
|
+
verificationGasLimit: string;
|
43
|
+
preVerificationGas: string;
|
44
|
+
maxFeePerGas: string;
|
45
|
+
maxPriorityFeePerGas: string;
|
46
|
+
paymasterVerificationGasLimit: string;
|
47
|
+
paymasterPostOpGasLimit: string;
|
48
|
+
signature: string;
|
49
|
+
paymaster: string;
|
50
|
+
paymasterData: string;
|
51
|
+
entrypoint: string;
|
52
|
+
};
|
53
|
+
export interface OnchainOperation {
|
54
|
+
chainId: bigint;
|
55
|
+
data: string;
|
56
|
+
estimatedNetworkFees?: CurrencyAmount;
|
57
|
+
estimatedNetworkFeesInFiatCurrency?: CurrencyAmount;
|
58
|
+
estimatedTimeInMs?: number;
|
59
|
+
format: OperationDataFormat;
|
60
|
+
from?: string;
|
61
|
+
gasLimit?: bigint;
|
62
|
+
gasPrice?: bigint;
|
63
|
+
inputState?: State;
|
64
|
+
maxFeePerGas?: bigint;
|
65
|
+
maxPriorityFeePerGas?: bigint;
|
66
|
+
nativeCurrency?: Currency;
|
67
|
+
nonce?: bigint;
|
68
|
+
outputState?: State;
|
69
|
+
to?: string;
|
70
|
+
txRpcUrl: string;
|
71
|
+
type: OperationType;
|
72
|
+
value?: bigint;
|
73
|
+
}
|
74
|
+
export type SignedOperation = {
|
75
|
+
type: OperationType;
|
76
|
+
signature: string;
|
77
|
+
category?: Category;
|
78
|
+
data?: string;
|
79
|
+
from?: string;
|
80
|
+
chainId?: string;
|
81
|
+
};
|
82
|
+
export type OperationStatus = {
|
83
|
+
blockHash?: string;
|
84
|
+
blockNumber?: bigint;
|
85
|
+
chainId?: bigint;
|
86
|
+
errorReason?: string;
|
87
|
+
hash?: string;
|
88
|
+
id?: string;
|
89
|
+
status: OperationStatusType;
|
90
|
+
type: OperationType;
|
91
|
+
};
|
92
|
+
export type Activity = {
|
93
|
+
aggregateFiatValueOfInputState?: CurrencyAmount;
|
94
|
+
aggregateFiatValueOfOutputState?: CurrencyAmount;
|
95
|
+
aggregateNetworkFeesInFiatCurrency?: CurrencyAmount;
|
96
|
+
aggregateProtocolFeesInFiatCurrency?: CurrencyAmount;
|
97
|
+
category: Category;
|
98
|
+
initiateAt?: Date;
|
99
|
+
inputState?: State;
|
100
|
+
operationStatuses: OperationStatus[];
|
101
|
+
outputState?: State;
|
102
|
+
overallStatus: ActivityStatus;
|
103
|
+
};
|
104
|
+
export type FungibleTokenOverview = {
|
105
|
+
tokenCount: number;
|
106
|
+
hiddenTokenCount: number;
|
107
|
+
totalValueInFiat: CurrencyAmount;
|
108
|
+
};
|
109
|
+
export type StandardizedBalance = {
|
110
|
+
standardizedTokenId: string;
|
111
|
+
tokenBalances: FungibleTokenAmount[];
|
112
|
+
tokenBalancesOnChains: FungibleTokenAmount[];
|
113
|
+
total: CurrencyAmount;
|
114
|
+
totalValueInFiat?: CurrencyAmount;
|
115
|
+
};
|
116
|
+
export type StandardizedToken = {
|
117
|
+
standardizedTokenId: string;
|
118
|
+
currency: Currency;
|
119
|
+
priceInFiat?: CurrencyAmount;
|
120
|
+
tokens: FungibleToken[];
|
121
|
+
};
|
122
|
+
export type BlockchainInformation = {
|
123
|
+
chainId: bigint;
|
124
|
+
environment: BlockchainEnvironment;
|
125
|
+
logoUrl?: string;
|
126
|
+
name?: string;
|
127
|
+
};
|
128
|
+
export type ContractAllowlistWithAllMethodFallback = {
|
129
|
+
contractAddress: string;
|
130
|
+
sponsoredFunctions?: string[];
|
131
|
+
};
|
132
|
+
export type TokenAllowlistWithAllMethodsFallback = {
|
133
|
+
sponsoredFunctions?: string[];
|
134
|
+
tokenAllowlistType: TokenAllowlistType;
|
135
|
+
};
|
136
|
+
export type AllowlistWithOpenFallback = {
|
137
|
+
arbitraryContractAllowlist?: ContractAllowlistWithAllMethodFallback[];
|
138
|
+
tokenAllowlist?: TokenAllowlistWithAllMethodsFallback;
|
139
|
+
};
|
140
|
+
export type TimeInterval = {
|
141
|
+
amount?: bigint;
|
142
|
+
unit: TimeIntervalUnits;
|
143
|
+
};
|
144
|
+
export type MaxAmountPerInterval = {
|
145
|
+
amount: bigint;
|
146
|
+
interval: TimeInterval;
|
147
|
+
};
|
148
|
+
export type GasSponsorshipPolicy = {
|
149
|
+
allowlistWithOpenFallback?: AllowlistWithOpenFallback;
|
150
|
+
maxGasSpendPerTransaction?: bigint;
|
151
|
+
maxTotalGasSpendForInstance?: MaxAmountPerInterval;
|
152
|
+
maxTotalGasSpendPerUser?: MaxAmountPerInterval;
|
153
|
+
maxTotalTransactionCountForInstance?: MaxAmountPerInterval;
|
154
|
+
maxTotalTransactionCountPerUser?: MaxAmountPerInterval;
|
155
|
+
};
|
156
|
+
export type GasSpendForInstance = {
|
157
|
+
instanceName?: string;
|
158
|
+
gasSpentForInstance?: GasSponsorshipData;
|
159
|
+
};
|
160
|
+
export type GasSponsorshipData = {
|
161
|
+
totalGasSpent: CurrencyAmount;
|
162
|
+
totalTransactionCount: bigint;
|
163
|
+
};
|
164
|
+
export type ChainConfigs = {
|
165
|
+
environment: BlockchainEnvironment;
|
166
|
+
chainId: bigint;
|
167
|
+
};
|
168
|
+
export type VirtualNodeRpcUrlForSupportedChain = {
|
169
|
+
chainId: string;
|
170
|
+
entrypointAccountAddress: string;
|
171
|
+
virtualNodeRpcUrl: string;
|
172
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { AccountCluster, Activity, AllowlistWithOpenFallback, BlockchainInformation, FungibleTokenOverview, GasSpendForInstance, GasSponsorshipData, GasSponsorshipPolicy, Intent, MaxAmountPerInterval, OnchainOperation, OperationSet, OperationStatus, StandardizedBalance, StandardizedToken } from "../types.js";
|
2
|
+
export declare const extractAccountCluster: (accountCluster?: any) => AccountCluster;
|
3
|
+
export declare const extractOperationSet: (operationSet?: any) => OperationSet;
|
4
|
+
export declare const extractOnchainOperation: (onchainOperation?: any) => OnchainOperation;
|
5
|
+
export declare const extractIntent: (intent?: any) => Intent;
|
6
|
+
export declare const extractOperationStatuses: (operationStatus?: any[]) => OperationStatus[];
|
7
|
+
export declare const extractOperationStatus: (status?: any) => OperationStatus;
|
8
|
+
export declare const extractActivities: (activities?: any[]) => Activity[];
|
9
|
+
export declare const extractFungibleTokenOverview: (overview?: any) => FungibleTokenOverview;
|
10
|
+
export declare const extractStandardizedBalances: (balances?: any) => StandardizedBalance[];
|
11
|
+
export declare const extractStandardizedBalance: (balance?: any) => StandardizedBalance;
|
12
|
+
export declare const extractStandardizedTokens: (tokens?: any) => StandardizedToken[];
|
13
|
+
export declare const extractStandardizedToken: (token?: any) => StandardizedToken;
|
14
|
+
export declare const extractBlockchainInformations: (blockchainInformation?: any[]) => BlockchainInformation[];
|
15
|
+
export declare const extractBlockchainInformation: (blockchainInformation?: any) => BlockchainInformation;
|
16
|
+
export declare const extractMaxAmountPerInterval: (maxAmountPerInterval?: any) => MaxAmountPerInterval;
|
17
|
+
export declare const extractAllowlistWithOpenFallback: (allowlist?: any) => AllowlistWithOpenFallback;
|
18
|
+
export declare const extractGasSponsorshipPolicy: (gasSponsorshipPolicy?: any) => GasSponsorshipPolicy;
|
19
|
+
export declare const extractGasSpendForInstances: (gasSpendForInstances?: any[]) => GasSpendForInstance[];
|
20
|
+
export declare const extractGasSpendForInstance: (gasSpendForInstance?: any) => GasSpendForInstance;
|
21
|
+
export declare const extractGasSponsorshipInformation: (gasSponsorshipData?: any[]) => GasSponsorshipData[];
|
22
|
+
export declare const extractGasSponsorshipData: (gasSponsorshipData?: any) => GasSponsorshipData;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { Blockchain } from "../enums.js";
|
2
|
+
export declare const getChainIdFromOrbyChainId: (value: string) => bigint | undefined;
|
3
|
+
export declare const getOrbyChainId: (chainId: bigint) => string;
|
4
|
+
export declare const getBlockchainIdFromBlockchain: (blockchain: Blockchain) => number;
|
5
|
+
export declare const hasError: (data: any) => {
|
6
|
+
code: number;
|
7
|
+
message: string;
|
8
|
+
};
|
9
|
+
export declare const getBlockchainFromName: (chainName: string) => Blockchain;
|
10
|
+
export declare const isMainnet: (chainId: bigint) => boolean;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* Validates an address and returns the parsed (checksummed) version of that address
|
3
|
+
* @param address the unchecksummed hex address
|
4
|
+
*/
|
5
|
+
export declare function validateAndParseAddress(address: string): string;
|
6
|
+
/**
|
7
|
+
* Checks if an address is valid by checking 0x prefix, length === 42 and hex encoding.
|
8
|
+
* @param address the unchecksummed hex address
|
9
|
+
*/
|
10
|
+
export declare function checkValidAddress(address: string): string;
|