@0xobelisk/client 0.2.8 → 0.3.0
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.js +179 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +181 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -5
- package/src/libs/suiInteractor/suiInteractor.ts +59 -9
- package/src/obelisk.ts +164 -2
- package/src/types/index.ts +79 -51
- package/src/utils/index.ts +21 -1
- package/dist/framework/bcs.d.ts +0 -3
- package/dist/framework/loader.d.ts +0 -11
- package/dist/framework/util.d.ts +0 -90
- package/dist/index.d.ts +0 -9
- package/dist/libs/suiAccountManager/crypto.d.ts +0 -1
- package/dist/libs/suiAccountManager/index.d.ts +0 -35
- package/dist/libs/suiAccountManager/keypair.d.ts +0 -21
- package/dist/libs/suiAccountManager/types.d.ts +0 -9
- package/dist/libs/suiAccountManager/util.d.ts +0 -29
- package/dist/libs/suiContractFactory/index.d.ts +0 -20
- package/dist/libs/suiContractFactory/types.d.ts +0 -49
- package/dist/libs/suiInteractor/defaultConfig.d.ts +0 -10
- package/dist/libs/suiInteractor/index.d.ts +0 -2
- package/dist/libs/suiInteractor/suiInteractor.d.ts +0 -204
- package/dist/libs/suiInteractor/util.d.ts +0 -1
- package/dist/libs/suiModel/index.d.ts +0 -2
- package/dist/libs/suiModel/suiOwnedObject.d.ts +0 -24
- package/dist/libs/suiModel/suiSharedObject.d.ts +0 -12
- package/dist/libs/suiRpcProvider/defaultChainConfigs.d.ts +0 -8
- package/dist/libs/suiRpcProvider/faucet.d.ts +0 -8
- package/dist/libs/suiRpcProvider/index.d.ts +0 -213
- package/dist/libs/suiRpcProvider/types.d.ts +0 -14
- package/dist/libs/suiTxBuilder/index.d.ts +0 -544
- package/dist/libs/suiTxBuilder/types.d.ts +0 -12
- package/dist/libs/suiTxBuilder/util.d.ts +0 -76
- package/dist/metadata/index.d.ts +0 -34
- package/dist/obelisk.d.ts +0 -2691
- package/dist/types/index.d.ts +0 -114
- package/dist/utils/index.d.ts +0 -1
- package/src/framework/bcs.ts +0 -6
- package/src/framework/loader.ts +0 -152
- package/src/framework/util.ts +0 -219
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This regular expression matches any string that contains only hexadecimal digits (0-9, A-F, a-f).
|
|
3
|
-
* @param str
|
|
4
|
-
*/
|
|
5
|
-
export declare const isHex: (str: string) => boolean;
|
|
6
|
-
/**
|
|
7
|
-
* @description This regular expression matches any string that contains only base64 digits (0-9, A-Z, a-z, +, /, =).
|
|
8
|
-
* Note that the "=" signs at the end are optional padding characters that may be present in some base64 encoded strings.
|
|
9
|
-
* @param str
|
|
10
|
-
*/
|
|
11
|
-
export declare const isBase64: (str: string) => boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Convert a hex string to Uint8Array
|
|
14
|
-
* @param hexStr
|
|
15
|
-
*/
|
|
16
|
-
export declare const fromHEX: (hexStr: string) => Uint8Array;
|
|
17
|
-
/**
|
|
18
|
-
* @description Convert a hex or base64 string to Uint8Array
|
|
19
|
-
*/
|
|
20
|
-
export declare const hexOrBase64ToUint8Array: (str: string) => Uint8Array;
|
|
21
|
-
/**
|
|
22
|
-
* normalize a private key
|
|
23
|
-
* A private key is a 32-byte array.
|
|
24
|
-
* But there are two different formats for private keys:
|
|
25
|
-
* 1. A 32-byte array
|
|
26
|
-
* 2. A 64-byte array with the first 32 bytes being the private key and the last 32 bytes being the public key
|
|
27
|
-
* 3. A 33-byte array with the first byte being 0x00 (sui.keystore key is a Base64 string with scheme flag 0x00 at the beginning)
|
|
28
|
-
*/
|
|
29
|
-
export declare const normalizePrivateKey: (key: Uint8Array) => Uint8Array;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SuiMoveNormalizedModules } from '@mysten/sui.js';
|
|
2
|
-
import type { ContractFactoryParams } from './types';
|
|
3
|
-
export type ApiTypes = 'promise' | 'rxjs';
|
|
4
|
-
export declare class SuiContractFactory {
|
|
5
|
-
packageId: string;
|
|
6
|
-
metadata: SuiMoveNormalizedModules | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Support the following ways to init the SuiToolkit:
|
|
9
|
-
* 1. mnemonics
|
|
10
|
-
* 2. secretKey (base64 or hex)
|
|
11
|
-
* If none of them is provided, will generate a random mnemonics with 24 words.
|
|
12
|
-
*
|
|
13
|
-
* @param mnemonics, 12 or 24 mnemonics words, separated by space
|
|
14
|
-
* @param secretKey, base64 or hex string, when mnemonics is provided, secretKey will be ignored
|
|
15
|
-
*/
|
|
16
|
-
constructor({ packageId, metadata }?: ContractFactoryParams);
|
|
17
|
-
getFuncByModuleName(moduleName: string): void;
|
|
18
|
-
getAllFunc(): void;
|
|
19
|
-
getAllModule(): void;
|
|
20
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { SuiMoveNormalizedModules, SuiMoveNormalizedType } from "@mysten/sui.js";
|
|
2
|
-
export type ContractFactoryParams = {
|
|
3
|
-
packageId?: string;
|
|
4
|
-
metadata?: SuiMoveNormalizedModules;
|
|
5
|
-
};
|
|
6
|
-
export type SuiMoveMoudleValueType = {
|
|
7
|
-
address: string;
|
|
8
|
-
name: string;
|
|
9
|
-
fileFormatVersion: number;
|
|
10
|
-
friends: {
|
|
11
|
-
address: string;
|
|
12
|
-
name: string;
|
|
13
|
-
}[];
|
|
14
|
-
structs: Record<string, {
|
|
15
|
-
fields: {
|
|
16
|
-
type: SuiMoveNormalizedType;
|
|
17
|
-
name: string;
|
|
18
|
-
}[];
|
|
19
|
-
abilities: {
|
|
20
|
-
abilities: string[];
|
|
21
|
-
};
|
|
22
|
-
typeParameters: {
|
|
23
|
-
constraints: {
|
|
24
|
-
abilities: string[];
|
|
25
|
-
};
|
|
26
|
-
isPhantom: boolean;
|
|
27
|
-
}[];
|
|
28
|
-
}>;
|
|
29
|
-
exposedFunctions: Record<string, {
|
|
30
|
-
visibility: "Private" | "Public" | "Friend";
|
|
31
|
-
isEntry: boolean;
|
|
32
|
-
typeParameters: {
|
|
33
|
-
abilities: string[];
|
|
34
|
-
}[];
|
|
35
|
-
parameters: SuiMoveNormalizedType[];
|
|
36
|
-
return: SuiMoveNormalizedType[];
|
|
37
|
-
}>;
|
|
38
|
-
};
|
|
39
|
-
export type SuiMoveMoudleFuncType = {
|
|
40
|
-
moudleName: string;
|
|
41
|
-
funcName: string;
|
|
42
|
-
visibility: "Private" | "Public" | "Friend";
|
|
43
|
-
isEntry: boolean;
|
|
44
|
-
typeParameters: {
|
|
45
|
-
abilities: string[];
|
|
46
|
-
}[];
|
|
47
|
-
parameters: SuiMoveNormalizedType[];
|
|
48
|
-
return: SuiMoveNormalizedType[];
|
|
49
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Connection } from '@mysten/sui.js';
|
|
2
|
-
import type { NetworkType } from 'src/types';
|
|
3
|
-
export declare const defaultGasBudget: number;
|
|
4
|
-
export declare const defaultGasPrice = 1000;
|
|
5
|
-
/**
|
|
6
|
-
* @description Get the default fullnode url and faucet url for the given network type
|
|
7
|
-
* @param networkType, 'testnet' | 'mainnet' | 'devnet' | 'localnet', default is 'devnet'
|
|
8
|
-
* @returns { fullNode: string, websocket: string, faucet?: string }
|
|
9
|
-
*/
|
|
10
|
-
export declare const getDefaultConnection: (networkType?: NetworkType) => Connection;
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { SuiTransactionBlockResponse, JsonRpcProvider, DynamicFieldName, SuiAddress } from '@mysten/sui.js';
|
|
2
|
-
import { FaucetNetworkType, NetworkType, ObjectData } from 'src/types';
|
|
3
|
-
import { SuiOwnedObject, SuiSharedObject } from '../suiModel';
|
|
4
|
-
/**
|
|
5
|
-
* `SuiTransactionSender` is used to send transaction with a given gas coin.
|
|
6
|
-
* It always uses the gas coin to pay for the gas,
|
|
7
|
-
* and update the gas coin after the transaction.
|
|
8
|
-
*/
|
|
9
|
-
export declare class SuiInteractor {
|
|
10
|
-
readonly providers: JsonRpcProvider[];
|
|
11
|
-
currentProvider: JsonRpcProvider;
|
|
12
|
-
network?: NetworkType;
|
|
13
|
-
constructor(fullNodeUrls: string[], network?: NetworkType);
|
|
14
|
-
switchToNextProvider(): void;
|
|
15
|
-
sendTx(transactionBlock: Uint8Array | string, signature: string | string[]): Promise<SuiTransactionBlockResponse>;
|
|
16
|
-
getObjects(ids: string[]): Promise<ObjectData[]>;
|
|
17
|
-
getObject(id: string): Promise<ObjectData>;
|
|
18
|
-
getDynamicFieldObject(parentId: string, name: string | DynamicFieldName): Promise<{
|
|
19
|
-
data?: {
|
|
20
|
-
objectId: string;
|
|
21
|
-
version: string;
|
|
22
|
-
digest: string;
|
|
23
|
-
type?: string | null | undefined;
|
|
24
|
-
bcs?: {
|
|
25
|
-
type: string;
|
|
26
|
-
version: string;
|
|
27
|
-
hasPublicTransfer: boolean;
|
|
28
|
-
dataType: "moveObject";
|
|
29
|
-
bcsBytes: string;
|
|
30
|
-
} | {
|
|
31
|
-
id: string;
|
|
32
|
-
dataType: "package";
|
|
33
|
-
moduleMap: Record<string, string>;
|
|
34
|
-
} | null | undefined;
|
|
35
|
-
owner?: {
|
|
36
|
-
AddressOwner: string;
|
|
37
|
-
} | {
|
|
38
|
-
ObjectOwner: string;
|
|
39
|
-
} | {
|
|
40
|
-
Shared: {
|
|
41
|
-
initial_shared_version: string | null;
|
|
42
|
-
};
|
|
43
|
-
} | "Immutable" | null | undefined;
|
|
44
|
-
storageRebate?: string | null | undefined;
|
|
45
|
-
previousTransaction?: string | null | undefined;
|
|
46
|
-
content?: {
|
|
47
|
-
type: string;
|
|
48
|
-
fields: Record<string, any>;
|
|
49
|
-
hasPublicTransfer: boolean;
|
|
50
|
-
dataType: "moveObject";
|
|
51
|
-
} | {
|
|
52
|
-
disassembled: Record<string, unknown>;
|
|
53
|
-
dataType: "package";
|
|
54
|
-
} | null | undefined;
|
|
55
|
-
display?: Record<string, string> | {
|
|
56
|
-
data?: Record<string, string> | null | undefined;
|
|
57
|
-
error?: {
|
|
58
|
-
code: string;
|
|
59
|
-
version?: string | undefined;
|
|
60
|
-
digest?: string | undefined;
|
|
61
|
-
error?: string | undefined;
|
|
62
|
-
object_id?: string | undefined;
|
|
63
|
-
parent_object_id?: string | undefined;
|
|
64
|
-
} | null | undefined;
|
|
65
|
-
} | null | undefined;
|
|
66
|
-
} | null | undefined;
|
|
67
|
-
error?: {
|
|
68
|
-
code: string;
|
|
69
|
-
version?: string | undefined;
|
|
70
|
-
digest?: string | undefined;
|
|
71
|
-
error?: string | undefined;
|
|
72
|
-
object_id?: string | undefined;
|
|
73
|
-
parent_object_id?: string | undefined;
|
|
74
|
-
} | null | undefined;
|
|
75
|
-
}>;
|
|
76
|
-
getDynamicFields(parentId: string, cursor?: string, limit?: number): Promise<{
|
|
77
|
-
data: {
|
|
78
|
-
type: "DynamicField" | "DynamicObject";
|
|
79
|
-
objectType: string;
|
|
80
|
-
objectId: string;
|
|
81
|
-
version: number;
|
|
82
|
-
digest: string;
|
|
83
|
-
name: {
|
|
84
|
-
type: string;
|
|
85
|
-
value?: any;
|
|
86
|
-
};
|
|
87
|
-
bcsName: string;
|
|
88
|
-
}[];
|
|
89
|
-
nextCursor: string | null;
|
|
90
|
-
hasNextPage: boolean;
|
|
91
|
-
}>;
|
|
92
|
-
getOwnedObjects(owner: SuiAddress, cursor?: string, limit?: number): Promise<{
|
|
93
|
-
data: {
|
|
94
|
-
data?: {
|
|
95
|
-
objectId: string;
|
|
96
|
-
version: string;
|
|
97
|
-
digest: string;
|
|
98
|
-
type?: string | null | undefined;
|
|
99
|
-
bcs?: {
|
|
100
|
-
type: string;
|
|
101
|
-
version: string;
|
|
102
|
-
hasPublicTransfer: boolean;
|
|
103
|
-
dataType: "moveObject";
|
|
104
|
-
bcsBytes: string;
|
|
105
|
-
} | {
|
|
106
|
-
id: string;
|
|
107
|
-
dataType: "package";
|
|
108
|
-
moduleMap: Record<string, string>;
|
|
109
|
-
} | null | undefined;
|
|
110
|
-
owner?: "Immutable" | {
|
|
111
|
-
AddressOwner: string;
|
|
112
|
-
} | {
|
|
113
|
-
ObjectOwner: string;
|
|
114
|
-
} | {
|
|
115
|
-
Shared: {
|
|
116
|
-
initial_shared_version: string | null;
|
|
117
|
-
};
|
|
118
|
-
} | null | undefined;
|
|
119
|
-
storageRebate?: string | null | undefined;
|
|
120
|
-
previousTransaction?: string | null | undefined;
|
|
121
|
-
content?: {
|
|
122
|
-
type: string;
|
|
123
|
-
fields: Record<string, any>;
|
|
124
|
-
hasPublicTransfer: boolean;
|
|
125
|
-
dataType: "moveObject";
|
|
126
|
-
} | {
|
|
127
|
-
disassembled: Record<string, unknown>;
|
|
128
|
-
dataType: "package";
|
|
129
|
-
} | null | undefined;
|
|
130
|
-
display?: Record<string, string> | {
|
|
131
|
-
data?: Record<string, string> | null | undefined;
|
|
132
|
-
error?: {
|
|
133
|
-
code: string;
|
|
134
|
-
version?: string | undefined;
|
|
135
|
-
digest?: string | undefined;
|
|
136
|
-
error?: string | undefined;
|
|
137
|
-
object_id?: string | undefined;
|
|
138
|
-
parent_object_id?: string | undefined;
|
|
139
|
-
} | null | undefined;
|
|
140
|
-
} | null | undefined;
|
|
141
|
-
} | null | undefined;
|
|
142
|
-
error?: {
|
|
143
|
-
code: string;
|
|
144
|
-
version?: string | undefined;
|
|
145
|
-
digest?: string | undefined;
|
|
146
|
-
error?: string | undefined;
|
|
147
|
-
object_id?: string | undefined;
|
|
148
|
-
parent_object_id?: string | undefined;
|
|
149
|
-
} | null | undefined;
|
|
150
|
-
}[];
|
|
151
|
-
hasNextPage: boolean;
|
|
152
|
-
nextCursor?: string | null | undefined;
|
|
153
|
-
}>;
|
|
154
|
-
getNormalizedMoveModulesByPackage(packageId: string): Promise<Record<string, {
|
|
155
|
-
address: string;
|
|
156
|
-
name: string;
|
|
157
|
-
fileFormatVersion: number;
|
|
158
|
-
friends: {
|
|
159
|
-
address: string;
|
|
160
|
-
name: string;
|
|
161
|
-
}[];
|
|
162
|
-
structs: Record<string, {
|
|
163
|
-
fields: {
|
|
164
|
-
type: import("@mysten/sui.js").SuiMoveNormalizedType;
|
|
165
|
-
name: string;
|
|
166
|
-
}[];
|
|
167
|
-
abilities: {
|
|
168
|
-
abilities: string[];
|
|
169
|
-
};
|
|
170
|
-
typeParameters: {
|
|
171
|
-
constraints: {
|
|
172
|
-
abilities: string[];
|
|
173
|
-
};
|
|
174
|
-
isPhantom: boolean;
|
|
175
|
-
}[];
|
|
176
|
-
}>;
|
|
177
|
-
exposedFunctions: Record<string, {
|
|
178
|
-
visibility: "Private" | "Public" | "Friend";
|
|
179
|
-
isEntry: boolean;
|
|
180
|
-
typeParameters: {
|
|
181
|
-
abilities: string[];
|
|
182
|
-
}[];
|
|
183
|
-
parameters: import("@mysten/sui.js").SuiMoveNormalizedType[];
|
|
184
|
-
return: import("@mysten/sui.js").SuiMoveNormalizedType[];
|
|
185
|
-
}>;
|
|
186
|
-
}>>;
|
|
187
|
-
/**
|
|
188
|
-
* @description Update objects in a batch
|
|
189
|
-
* @param suiObjects
|
|
190
|
-
*/
|
|
191
|
-
updateObjects(suiObjects: (SuiOwnedObject | SuiSharedObject)[]): Promise<void>;
|
|
192
|
-
/**
|
|
193
|
-
* @description Select coins that add up to the given amount.
|
|
194
|
-
* @param addr the address of the owner
|
|
195
|
-
* @param amount the amount that is needed for the coin
|
|
196
|
-
* @param coinType the coin type, default is '0x2::SUI::SUI'
|
|
197
|
-
*/
|
|
198
|
-
selectCoins(addr: string, amount: number, coinType?: string): Promise<{
|
|
199
|
-
objectId: string;
|
|
200
|
-
digest: string;
|
|
201
|
-
version: string;
|
|
202
|
-
}[]>;
|
|
203
|
-
requestFaucet(address: SuiAddress, network: FaucetNetworkType): Promise<void>;
|
|
204
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const delay: (ms: number) => Promise<unknown>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Infer } from 'superstruct';
|
|
2
|
-
import { SuiTransactionBlockResponse, ObjectCallArg, ObjectId } from '@mysten/sui.js';
|
|
3
|
-
export declare class SuiOwnedObject {
|
|
4
|
-
readonly objectId: string;
|
|
5
|
-
version?: number | string;
|
|
6
|
-
digest?: string;
|
|
7
|
-
constructor(param: {
|
|
8
|
-
objectId: string;
|
|
9
|
-
version?: string;
|
|
10
|
-
digest?: string;
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* Check if the object is fully initialized.
|
|
14
|
-
* So that when it's used as an input, it won't be necessary to fetch from fullnode again.
|
|
15
|
-
* Which can save time when sending transactions.
|
|
16
|
-
*/
|
|
17
|
-
isFullObject(): boolean;
|
|
18
|
-
asCallArg(): Infer<typeof ObjectCallArg> | Infer<typeof ObjectId>;
|
|
19
|
-
/**
|
|
20
|
-
* Update object version & digest based on the transaction response.
|
|
21
|
-
* @param txResponse
|
|
22
|
-
*/
|
|
23
|
-
updateFromTxResponse(txResponse: SuiTransactionBlockResponse): void;
|
|
24
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Infer } from 'superstruct';
|
|
2
|
-
import { ObjectCallArg, ObjectId } from '@mysten/sui.js';
|
|
3
|
-
export declare class SuiSharedObject {
|
|
4
|
-
readonly objectId: string;
|
|
5
|
-
initialSharedVersion?: number | string;
|
|
6
|
-
constructor(param: {
|
|
7
|
-
objectId: string;
|
|
8
|
-
initialSharedVersion?: number;
|
|
9
|
-
mutable?: boolean;
|
|
10
|
-
});
|
|
11
|
-
asCallArg(mutable?: boolean): Infer<typeof ObjectCallArg> | Infer<typeof ObjectId>;
|
|
12
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Connection } from '@mysten/sui.js';
|
|
2
|
-
import type { NetworkType } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* @description Get the default fullnode url and faucet url for the given network type
|
|
5
|
-
* @param networkType, 'testnet' | 'mainnet' | 'devnet' | 'localnet', default is 'devnet'
|
|
6
|
-
* @returns { fullNode: string, websocket: string, faucet?: string }
|
|
7
|
-
*/
|
|
8
|
-
export declare const getDefaultNetworkParams: (networkType?: NetworkType) => Connection;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { JsonRpcProvider } from '@mysten/sui.js';
|
|
2
|
-
/**
|
|
3
|
-
* Request some SUI from faucet
|
|
4
|
-
* @param address
|
|
5
|
-
* @param provider
|
|
6
|
-
* @returns {Promise<boolean>}, return true if the request is successful
|
|
7
|
-
*/
|
|
8
|
-
export declare const requestFaucet: (address: string, provider: JsonRpcProvider) => Promise<void>;
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { JsonRpcProvider, DynamicFieldName, SuiAddress } from '@mysten/sui.js';
|
|
2
|
-
import type { ObjectData, SuiRpcProviderParams } from './types';
|
|
3
|
-
export declare class SuiRpcProvider {
|
|
4
|
-
fullnodeUrl: string;
|
|
5
|
-
faucetUrl?: string;
|
|
6
|
-
provider: JsonRpcProvider;
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @param networkType, 'testnet' | 'mainnet' | 'devnet' | 'localnet', default is 'devnet'
|
|
10
|
-
* @param fullnodeUrl, the fullnode url, default is the preconfig fullnode url for the given network type
|
|
11
|
-
* @param faucetUrl, the faucet url, default is the preconfig faucet url for the given network type
|
|
12
|
-
*/
|
|
13
|
-
constructor({ fullnodeUrl, faucetUrl, networkType, }?: SuiRpcProviderParams);
|
|
14
|
-
/**
|
|
15
|
-
* Request some SUI from faucet
|
|
16
|
-
* @Returns {Promise<boolean>}, true if the request is successful, false otherwise.
|
|
17
|
-
*/
|
|
18
|
-
requestFaucet(addr: string): Promise<void>;
|
|
19
|
-
getBalance(addr: string, coinType?: string): Promise<{
|
|
20
|
-
coinType: string;
|
|
21
|
-
coinObjectCount: number;
|
|
22
|
-
totalBalance: string;
|
|
23
|
-
lockedBalance: {
|
|
24
|
-
number?: number | undefined;
|
|
25
|
-
epochId?: number | undefined;
|
|
26
|
-
};
|
|
27
|
-
}>;
|
|
28
|
-
getDynamicFieldObject(parentId: string, name: string | DynamicFieldName): Promise<{
|
|
29
|
-
data?: {
|
|
30
|
-
objectId: string;
|
|
31
|
-
version: string;
|
|
32
|
-
digest: string;
|
|
33
|
-
type?: string | undefined;
|
|
34
|
-
bcs?: {
|
|
35
|
-
type: string;
|
|
36
|
-
version: number;
|
|
37
|
-
hasPublicTransfer: boolean;
|
|
38
|
-
dataType: "moveObject";
|
|
39
|
-
bcsBytes: string;
|
|
40
|
-
} | {
|
|
41
|
-
id: string;
|
|
42
|
-
dataType: "package";
|
|
43
|
-
moduleMap: Record<string, string>;
|
|
44
|
-
} | undefined;
|
|
45
|
-
owner?: {
|
|
46
|
-
AddressOwner: string;
|
|
47
|
-
} | {
|
|
48
|
-
ObjectOwner: string;
|
|
49
|
-
} | {
|
|
50
|
-
Shared: {
|
|
51
|
-
initial_shared_version: number;
|
|
52
|
-
};
|
|
53
|
-
} | "Immutable" | undefined;
|
|
54
|
-
storageRebate?: string | undefined;
|
|
55
|
-
previousTransaction?: string | undefined;
|
|
56
|
-
content?: {
|
|
57
|
-
type: string;
|
|
58
|
-
fields: Record<string, any>;
|
|
59
|
-
hasPublicTransfer: boolean;
|
|
60
|
-
dataType: "moveObject";
|
|
61
|
-
} | {
|
|
62
|
-
disassembled: Record<string, string>;
|
|
63
|
-
dataType: "package";
|
|
64
|
-
} | undefined;
|
|
65
|
-
display?: Record<string, string> | {
|
|
66
|
-
data: Record<string, string> | null;
|
|
67
|
-
error: {
|
|
68
|
-
code: string;
|
|
69
|
-
version?: number | undefined;
|
|
70
|
-
digest?: string | undefined;
|
|
71
|
-
error?: string | undefined;
|
|
72
|
-
object_id?: string | undefined;
|
|
73
|
-
parent_object_id?: string | undefined;
|
|
74
|
-
} | null;
|
|
75
|
-
} | undefined;
|
|
76
|
-
} | undefined;
|
|
77
|
-
error?: {
|
|
78
|
-
code: string;
|
|
79
|
-
version?: number | undefined;
|
|
80
|
-
digest?: string | undefined;
|
|
81
|
-
error?: string | undefined;
|
|
82
|
-
object_id?: string | undefined;
|
|
83
|
-
parent_object_id?: string | undefined;
|
|
84
|
-
} | undefined;
|
|
85
|
-
}>;
|
|
86
|
-
getDynamicFields(parentId: string, cursor?: string, limit?: number): Promise<{
|
|
87
|
-
data: {
|
|
88
|
-
type: "DynamicField" | "DynamicObject";
|
|
89
|
-
objectType: string;
|
|
90
|
-
objectId: string;
|
|
91
|
-
version: number;
|
|
92
|
-
digest: string;
|
|
93
|
-
name: {
|
|
94
|
-
type: string;
|
|
95
|
-
value?: any;
|
|
96
|
-
};
|
|
97
|
-
bcsName: string;
|
|
98
|
-
}[];
|
|
99
|
-
nextCursor: string | null;
|
|
100
|
-
hasNextPage: boolean;
|
|
101
|
-
}>;
|
|
102
|
-
getOwnedObjects(owner: SuiAddress, cursor?: string, limit?: number): Promise<{
|
|
103
|
-
data: {
|
|
104
|
-
data?: {
|
|
105
|
-
objectId: string;
|
|
106
|
-
version: string;
|
|
107
|
-
digest: string;
|
|
108
|
-
type?: string | undefined;
|
|
109
|
-
bcs?: {
|
|
110
|
-
type: string;
|
|
111
|
-
version: number;
|
|
112
|
-
hasPublicTransfer: boolean;
|
|
113
|
-
dataType: "moveObject";
|
|
114
|
-
bcsBytes: string;
|
|
115
|
-
} | {
|
|
116
|
-
id: string;
|
|
117
|
-
dataType: "package";
|
|
118
|
-
moduleMap: Record<string, string>;
|
|
119
|
-
} | undefined;
|
|
120
|
-
owner?: "Immutable" | {
|
|
121
|
-
AddressOwner: string;
|
|
122
|
-
} | {
|
|
123
|
-
ObjectOwner: string;
|
|
124
|
-
} | {
|
|
125
|
-
Shared: {
|
|
126
|
-
initial_shared_version: number;
|
|
127
|
-
};
|
|
128
|
-
} | undefined;
|
|
129
|
-
storageRebate?: string | undefined;
|
|
130
|
-
previousTransaction?: string | undefined;
|
|
131
|
-
content?: {
|
|
132
|
-
type: string;
|
|
133
|
-
fields: Record<string, any>;
|
|
134
|
-
hasPublicTransfer: boolean;
|
|
135
|
-
dataType: "moveObject";
|
|
136
|
-
} | {
|
|
137
|
-
disassembled: Record<string, string>;
|
|
138
|
-
dataType: "package";
|
|
139
|
-
} | undefined;
|
|
140
|
-
display?: Record<string, string> | {
|
|
141
|
-
data: Record<string, string> | null;
|
|
142
|
-
error: {
|
|
143
|
-
code: string;
|
|
144
|
-
version?: number | undefined;
|
|
145
|
-
digest?: string | undefined;
|
|
146
|
-
error?: string | undefined;
|
|
147
|
-
object_id?: string | undefined;
|
|
148
|
-
parent_object_id?: string | undefined;
|
|
149
|
-
} | null;
|
|
150
|
-
} | undefined;
|
|
151
|
-
} | undefined;
|
|
152
|
-
error?: {
|
|
153
|
-
code: string;
|
|
154
|
-
version?: number | undefined;
|
|
155
|
-
digest?: string | undefined;
|
|
156
|
-
error?: string | undefined;
|
|
157
|
-
object_id?: string | undefined;
|
|
158
|
-
parent_object_id?: string | undefined;
|
|
159
|
-
} | undefined;
|
|
160
|
-
}[];
|
|
161
|
-
nextCursor: string | {
|
|
162
|
-
objectId: string;
|
|
163
|
-
atCheckpoint?: number | undefined;
|
|
164
|
-
} | null;
|
|
165
|
-
hasNextPage: boolean;
|
|
166
|
-
}>;
|
|
167
|
-
getObject(id: string): Promise<ObjectData>;
|
|
168
|
-
getObjects(ids: string[]): Promise<ObjectData[]>;
|
|
169
|
-
getNormalizedMoveModulesByPackage(packageId: string): Promise<Record<string, {
|
|
170
|
-
address: string;
|
|
171
|
-
name: string;
|
|
172
|
-
fileFormatVersion: number;
|
|
173
|
-
friends: {
|
|
174
|
-
address: string;
|
|
175
|
-
name: string;
|
|
176
|
-
}[];
|
|
177
|
-
structs: Record<string, {
|
|
178
|
-
fields: {
|
|
179
|
-
type: import("@mysten/sui.js").SuiMoveNormalizedType;
|
|
180
|
-
name: string;
|
|
181
|
-
}[];
|
|
182
|
-
abilities: {
|
|
183
|
-
abilities: string[];
|
|
184
|
-
};
|
|
185
|
-
typeParameters: {
|
|
186
|
-
constraints: {
|
|
187
|
-
abilities: string[];
|
|
188
|
-
};
|
|
189
|
-
isPhantom: boolean;
|
|
190
|
-
}[];
|
|
191
|
-
}>;
|
|
192
|
-
exposedFunctions: Record<string, {
|
|
193
|
-
visibility: "Private" | "Public" | "Friend";
|
|
194
|
-
isEntry: boolean;
|
|
195
|
-
typeParameters: {
|
|
196
|
-
abilities: string[];
|
|
197
|
-
}[];
|
|
198
|
-
parameters: import("@mysten/sui.js").SuiMoveNormalizedType[];
|
|
199
|
-
return: import("@mysten/sui.js").SuiMoveNormalizedType[];
|
|
200
|
-
}>;
|
|
201
|
-
}>>;
|
|
202
|
-
/**
|
|
203
|
-
* @description Select coins that add up to the given amount.
|
|
204
|
-
* @param addr the address of the owner
|
|
205
|
-
* @param amount the amount that is needed for the coin
|
|
206
|
-
* @param coinType the coin type, default is '0x2::SUI::SUI'
|
|
207
|
-
*/
|
|
208
|
-
selectCoins(addr: string, amount: number, coinType?: string): Promise<{
|
|
209
|
-
objectId: string;
|
|
210
|
-
digest: string;
|
|
211
|
-
version: string;
|
|
212
|
-
}[]>;
|
|
213
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DisplayFieldsResponse, ObjectContentFields } from '@mysten/sui.js';
|
|
2
|
-
export type NetworkType = 'testnet' | 'mainnet' | 'devnet' | 'localnet';
|
|
3
|
-
export type ObjectData = {
|
|
4
|
-
objectId: string;
|
|
5
|
-
objectType: string;
|
|
6
|
-
objectVersion: number;
|
|
7
|
-
objectDisplay: DisplayFieldsResponse;
|
|
8
|
-
objectFields: ObjectContentFields;
|
|
9
|
-
};
|
|
10
|
-
export type SuiRpcProviderParams = {
|
|
11
|
-
fullnodeUrl?: string;
|
|
12
|
-
faucetUrl?: string;
|
|
13
|
-
networkType?: NetworkType;
|
|
14
|
-
};
|