@vleap/warps-adapter-near 0.1.0-beta.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.
- package/dist/index.d.cts +155 -0
- package/dist/index.d.ts +155 -0
- package/dist/index.js +1171 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1145 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +45 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { WarpChainAsset, AdapterFactory, WarpChain, WarpChainEnv, AdapterWarpDataLoader, WarpClientConfig, WarpChainInfo, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, WarpActionExecutionResult, AdapterWarpExplorer, AdapterWarpOutput, Warp, WarpActionIndex, WarpAdapterGenericRemoteTransaction, ResolvedInput, WarpNativeValue, WarpExecutionOutput, AdapterWarpSerializer, WarpSerializer, WarpActionInputType, BaseWarpActionInputType, WarpAdapterGenericType, AdapterWarpWallet, WarpAdapterGenericTransaction } from '@vleap/warps';
|
|
2
|
+
|
|
3
|
+
declare const NativeTokenNear: WarpChainAsset;
|
|
4
|
+
declare const getNearAdapter: AdapterFactory;
|
|
5
|
+
|
|
6
|
+
declare const WarpNearConstants: {
|
|
7
|
+
NativeToken: {
|
|
8
|
+
Identifier: string;
|
|
9
|
+
Decimals: number;
|
|
10
|
+
};
|
|
11
|
+
Gas: {
|
|
12
|
+
Default: string;
|
|
13
|
+
Transfer: string;
|
|
14
|
+
FunctionCall: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
declare enum NearExplorers {
|
|
18
|
+
NearExplorer = "near_explorer",
|
|
19
|
+
NearBlocks = "near_blocks",
|
|
20
|
+
NearScan = "nearscan"
|
|
21
|
+
}
|
|
22
|
+
type ExplorerName = NearExplorers;
|
|
23
|
+
declare const NearExplorerMap: {
|
|
24
|
+
readonly near: {
|
|
25
|
+
readonly mainnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
26
|
+
readonly testnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
27
|
+
readonly devnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
declare const ExplorerUrls: Record<ExplorerName, string>;
|
|
31
|
+
declare const NearExplorerNames: {
|
|
32
|
+
readonly mainnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
33
|
+
readonly testnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
34
|
+
readonly devnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
35
|
+
};
|
|
36
|
+
declare const NearExplorerUrls: Record<ExplorerName, string>;
|
|
37
|
+
|
|
38
|
+
declare const NearTokens: WarpChainAsset[];
|
|
39
|
+
declare const KnownTokens: Record<WarpChain, Record<string, WarpChainAsset[]>>;
|
|
40
|
+
declare const findKnownTokenById: (chain: WarpChain, env: WarpChainEnv, id: string) => WarpChainAsset | null;
|
|
41
|
+
declare const getKnownTokensForChain: (chainName: string, env?: string) => WarpChainAsset[];
|
|
42
|
+
|
|
43
|
+
declare class WarpNearDataLoader implements AdapterWarpDataLoader {
|
|
44
|
+
private readonly config;
|
|
45
|
+
private readonly chain;
|
|
46
|
+
private cache;
|
|
47
|
+
private nearConfig;
|
|
48
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
49
|
+
getAccount(address: string): Promise<WarpChainAccount>;
|
|
50
|
+
getAccountAssets(address: string): Promise<WarpChainAsset[]>;
|
|
51
|
+
getAsset(identifier: string): Promise<WarpChainAsset | null>;
|
|
52
|
+
getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
|
|
53
|
+
getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare class WarpNearExecutor implements AdapterWarpExecutor {
|
|
57
|
+
private readonly config;
|
|
58
|
+
private readonly chain;
|
|
59
|
+
private readonly serializer;
|
|
60
|
+
private readonly nearConfig;
|
|
61
|
+
private readonly output;
|
|
62
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
63
|
+
createTransaction(executable: WarpExecutable): Promise<any>;
|
|
64
|
+
createTransferTransaction(executable: WarpExecutable): Promise<any>;
|
|
65
|
+
createContractCallTransaction(executable: WarpExecutable): Promise<any>;
|
|
66
|
+
private createTokenTransferTransaction;
|
|
67
|
+
private createSingleTokenTransfer;
|
|
68
|
+
executeQuery(executable: WarpExecutable): Promise<WarpActionExecutionResult>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare class WarpNearExplorer implements AdapterWarpExplorer {
|
|
72
|
+
private readonly chain;
|
|
73
|
+
private readonly config;
|
|
74
|
+
constructor(chain: WarpChainInfo, config: WarpClientConfig);
|
|
75
|
+
private getExplorers;
|
|
76
|
+
private getPrimaryExplorer;
|
|
77
|
+
private getExplorerUrlByName;
|
|
78
|
+
getAccountUrl(address: string, explorer?: ExplorerName): string;
|
|
79
|
+
getTransactionUrl(hash: string, explorer?: ExplorerName): string;
|
|
80
|
+
getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
|
|
81
|
+
getAssetUrl(identifier: string, explorer?: ExplorerName): string;
|
|
82
|
+
getContractUrl(address: string, explorer?: ExplorerName): string;
|
|
83
|
+
getAllExplorers(): readonly ExplorerName[];
|
|
84
|
+
getExplorerByName(name: string): ExplorerName | undefined;
|
|
85
|
+
getAccountUrls(address: string): Record<ExplorerName, string>;
|
|
86
|
+
getTransactionUrls(hash: string): Record<ExplorerName, string>;
|
|
87
|
+
getAssetUrls(identifier: string): Record<ExplorerName, string>;
|
|
88
|
+
getContractUrls(address: string): Record<ExplorerName, string>;
|
|
89
|
+
getBlockUrls(blockNumber: string | number): Record<ExplorerName, string>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
declare class WarpNearOutput implements AdapterWarpOutput {
|
|
93
|
+
private readonly config;
|
|
94
|
+
private readonly chain;
|
|
95
|
+
private readonly serializer;
|
|
96
|
+
private readonly nearConfig;
|
|
97
|
+
private readonly cache;
|
|
98
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
99
|
+
getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
|
|
100
|
+
private createFailedExecution;
|
|
101
|
+
private handleWarpChainAction;
|
|
102
|
+
private handleTransactionHash;
|
|
103
|
+
extractQueryOutput(warp: Warp, typedValues: unknown[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
104
|
+
values: {
|
|
105
|
+
string: string[];
|
|
106
|
+
native: WarpNativeValue[];
|
|
107
|
+
mapped: Record<string, any>;
|
|
108
|
+
};
|
|
109
|
+
output: WarpExecutionOutput;
|
|
110
|
+
}>;
|
|
111
|
+
getTransactionStatus(txHash: string): Promise<{
|
|
112
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
113
|
+
blockNumber?: number;
|
|
114
|
+
gasUsed?: bigint;
|
|
115
|
+
}>;
|
|
116
|
+
getTransactionReceipt(txHash: string): Promise<any>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare class WarpNearSerializer implements AdapterWarpSerializer {
|
|
120
|
+
readonly coreSerializer: WarpSerializer;
|
|
121
|
+
constructor();
|
|
122
|
+
typedToString(value: any): string;
|
|
123
|
+
typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
|
|
124
|
+
nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
|
|
125
|
+
nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
|
|
126
|
+
stringToTyped(value: string): any;
|
|
127
|
+
private parseNativeValue;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare class WarpNearWallet implements AdapterWarpWallet {
|
|
131
|
+
private config;
|
|
132
|
+
private chain;
|
|
133
|
+
private nearConfig;
|
|
134
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
135
|
+
signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
|
|
136
|
+
signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
|
|
137
|
+
signMessage(message: string): Promise<string>;
|
|
138
|
+
sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
|
|
139
|
+
sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
|
|
140
|
+
create(mnemonic: string): {
|
|
141
|
+
address: string;
|
|
142
|
+
privateKey: string;
|
|
143
|
+
mnemonic: string;
|
|
144
|
+
};
|
|
145
|
+
generate(): {
|
|
146
|
+
address: string;
|
|
147
|
+
privateKey: string;
|
|
148
|
+
mnemonic: string;
|
|
149
|
+
};
|
|
150
|
+
getAddress(): string | null;
|
|
151
|
+
getPublicKey(): string | null;
|
|
152
|
+
private getKeyPair;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export { type ExplorerName, ExplorerUrls, KnownTokens, NativeTokenNear, NearExplorerMap, NearExplorerNames, NearExplorerUrls, NearExplorers, NearTokens, WarpNearConstants, WarpNearDataLoader, WarpNearExecutor, WarpNearExplorer, WarpNearOutput, WarpNearSerializer, WarpNearWallet, findKnownTokenById, getKnownTokensForChain, getNearAdapter };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { WarpChainAsset, AdapterFactory, WarpChain, WarpChainEnv, AdapterWarpDataLoader, WarpClientConfig, WarpChainInfo, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, WarpActionExecutionResult, AdapterWarpExplorer, AdapterWarpOutput, Warp, WarpActionIndex, WarpAdapterGenericRemoteTransaction, ResolvedInput, WarpNativeValue, WarpExecutionOutput, AdapterWarpSerializer, WarpSerializer, WarpActionInputType, BaseWarpActionInputType, WarpAdapterGenericType, AdapterWarpWallet, WarpAdapterGenericTransaction } from '@vleap/warps';
|
|
2
|
+
|
|
3
|
+
declare const NativeTokenNear: WarpChainAsset;
|
|
4
|
+
declare const getNearAdapter: AdapterFactory;
|
|
5
|
+
|
|
6
|
+
declare const WarpNearConstants: {
|
|
7
|
+
NativeToken: {
|
|
8
|
+
Identifier: string;
|
|
9
|
+
Decimals: number;
|
|
10
|
+
};
|
|
11
|
+
Gas: {
|
|
12
|
+
Default: string;
|
|
13
|
+
Transfer: string;
|
|
14
|
+
FunctionCall: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
declare enum NearExplorers {
|
|
18
|
+
NearExplorer = "near_explorer",
|
|
19
|
+
NearBlocks = "near_blocks",
|
|
20
|
+
NearScan = "nearscan"
|
|
21
|
+
}
|
|
22
|
+
type ExplorerName = NearExplorers;
|
|
23
|
+
declare const NearExplorerMap: {
|
|
24
|
+
readonly near: {
|
|
25
|
+
readonly mainnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
26
|
+
readonly testnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
27
|
+
readonly devnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
declare const ExplorerUrls: Record<ExplorerName, string>;
|
|
31
|
+
declare const NearExplorerNames: {
|
|
32
|
+
readonly mainnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
33
|
+
readonly testnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
34
|
+
readonly devnet: readonly [NearExplorers.NearExplorer, NearExplorers.NearBlocks, NearExplorers.NearScan];
|
|
35
|
+
};
|
|
36
|
+
declare const NearExplorerUrls: Record<ExplorerName, string>;
|
|
37
|
+
|
|
38
|
+
declare const NearTokens: WarpChainAsset[];
|
|
39
|
+
declare const KnownTokens: Record<WarpChain, Record<string, WarpChainAsset[]>>;
|
|
40
|
+
declare const findKnownTokenById: (chain: WarpChain, env: WarpChainEnv, id: string) => WarpChainAsset | null;
|
|
41
|
+
declare const getKnownTokensForChain: (chainName: string, env?: string) => WarpChainAsset[];
|
|
42
|
+
|
|
43
|
+
declare class WarpNearDataLoader implements AdapterWarpDataLoader {
|
|
44
|
+
private readonly config;
|
|
45
|
+
private readonly chain;
|
|
46
|
+
private cache;
|
|
47
|
+
private nearConfig;
|
|
48
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
49
|
+
getAccount(address: string): Promise<WarpChainAccount>;
|
|
50
|
+
getAccountAssets(address: string): Promise<WarpChainAsset[]>;
|
|
51
|
+
getAsset(identifier: string): Promise<WarpChainAsset | null>;
|
|
52
|
+
getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
|
|
53
|
+
getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare class WarpNearExecutor implements AdapterWarpExecutor {
|
|
57
|
+
private readonly config;
|
|
58
|
+
private readonly chain;
|
|
59
|
+
private readonly serializer;
|
|
60
|
+
private readonly nearConfig;
|
|
61
|
+
private readonly output;
|
|
62
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
63
|
+
createTransaction(executable: WarpExecutable): Promise<any>;
|
|
64
|
+
createTransferTransaction(executable: WarpExecutable): Promise<any>;
|
|
65
|
+
createContractCallTransaction(executable: WarpExecutable): Promise<any>;
|
|
66
|
+
private createTokenTransferTransaction;
|
|
67
|
+
private createSingleTokenTransfer;
|
|
68
|
+
executeQuery(executable: WarpExecutable): Promise<WarpActionExecutionResult>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare class WarpNearExplorer implements AdapterWarpExplorer {
|
|
72
|
+
private readonly chain;
|
|
73
|
+
private readonly config;
|
|
74
|
+
constructor(chain: WarpChainInfo, config: WarpClientConfig);
|
|
75
|
+
private getExplorers;
|
|
76
|
+
private getPrimaryExplorer;
|
|
77
|
+
private getExplorerUrlByName;
|
|
78
|
+
getAccountUrl(address: string, explorer?: ExplorerName): string;
|
|
79
|
+
getTransactionUrl(hash: string, explorer?: ExplorerName): string;
|
|
80
|
+
getBlockUrl(blockNumber: string | number, explorer?: ExplorerName): string;
|
|
81
|
+
getAssetUrl(identifier: string, explorer?: ExplorerName): string;
|
|
82
|
+
getContractUrl(address: string, explorer?: ExplorerName): string;
|
|
83
|
+
getAllExplorers(): readonly ExplorerName[];
|
|
84
|
+
getExplorerByName(name: string): ExplorerName | undefined;
|
|
85
|
+
getAccountUrls(address: string): Record<ExplorerName, string>;
|
|
86
|
+
getTransactionUrls(hash: string): Record<ExplorerName, string>;
|
|
87
|
+
getAssetUrls(identifier: string): Record<ExplorerName, string>;
|
|
88
|
+
getContractUrls(address: string): Record<ExplorerName, string>;
|
|
89
|
+
getBlockUrls(blockNumber: string | number): Record<ExplorerName, string>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
declare class WarpNearOutput implements AdapterWarpOutput {
|
|
93
|
+
private readonly config;
|
|
94
|
+
private readonly chain;
|
|
95
|
+
private readonly serializer;
|
|
96
|
+
private readonly nearConfig;
|
|
97
|
+
private readonly cache;
|
|
98
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
99
|
+
getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
|
|
100
|
+
private createFailedExecution;
|
|
101
|
+
private handleWarpChainAction;
|
|
102
|
+
private handleTransactionHash;
|
|
103
|
+
extractQueryOutput(warp: Warp, typedValues: unknown[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
104
|
+
values: {
|
|
105
|
+
string: string[];
|
|
106
|
+
native: WarpNativeValue[];
|
|
107
|
+
mapped: Record<string, any>;
|
|
108
|
+
};
|
|
109
|
+
output: WarpExecutionOutput;
|
|
110
|
+
}>;
|
|
111
|
+
getTransactionStatus(txHash: string): Promise<{
|
|
112
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
113
|
+
blockNumber?: number;
|
|
114
|
+
gasUsed?: bigint;
|
|
115
|
+
}>;
|
|
116
|
+
getTransactionReceipt(txHash: string): Promise<any>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare class WarpNearSerializer implements AdapterWarpSerializer {
|
|
120
|
+
readonly coreSerializer: WarpSerializer;
|
|
121
|
+
constructor();
|
|
122
|
+
typedToString(value: any): string;
|
|
123
|
+
typedToNative(value: any): [WarpActionInputType, WarpNativeValue];
|
|
124
|
+
nativeToTyped(type: WarpActionInputType, value: WarpNativeValue): any;
|
|
125
|
+
nativeToType(type: BaseWarpActionInputType): WarpAdapterGenericType;
|
|
126
|
+
stringToTyped(value: string): any;
|
|
127
|
+
private parseNativeValue;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare class WarpNearWallet implements AdapterWarpWallet {
|
|
131
|
+
private config;
|
|
132
|
+
private chain;
|
|
133
|
+
private nearConfig;
|
|
134
|
+
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
135
|
+
signTransaction(tx: WarpAdapterGenericTransaction): Promise<WarpAdapterGenericTransaction>;
|
|
136
|
+
signTransactions(txs: WarpAdapterGenericTransaction[]): Promise<WarpAdapterGenericTransaction[]>;
|
|
137
|
+
signMessage(message: string): Promise<string>;
|
|
138
|
+
sendTransaction(tx: WarpAdapterGenericTransaction): Promise<string>;
|
|
139
|
+
sendTransactions(txs: WarpAdapterGenericTransaction[]): Promise<string[]>;
|
|
140
|
+
create(mnemonic: string): {
|
|
141
|
+
address: string;
|
|
142
|
+
privateKey: string;
|
|
143
|
+
mnemonic: string;
|
|
144
|
+
};
|
|
145
|
+
generate(): {
|
|
146
|
+
address: string;
|
|
147
|
+
privateKey: string;
|
|
148
|
+
mnemonic: string;
|
|
149
|
+
};
|
|
150
|
+
getAddress(): string | null;
|
|
151
|
+
getPublicKey(): string | null;
|
|
152
|
+
private getKeyPair;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export { type ExplorerName, ExplorerUrls, KnownTokens, NativeTokenNear, NearExplorerMap, NearExplorerNames, NearExplorerUrls, NearExplorers, NearTokens, WarpNearConstants, WarpNearDataLoader, WarpNearExecutor, WarpNearExplorer, WarpNearOutput, WarpNearSerializer, WarpNearWallet, findKnownTokenById, getKnownTokensForChain, getNearAdapter };
|