@0xobelisk/sui-client 1.2.0-pre.115 → 1.2.0-pre.118
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/dubhe.d.ts +138 -206
- package/dist/index.js +291 -366
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +291 -366
- package/dist/index.mjs.map +1 -1
- package/dist/libs/suiInteractor/defaultConfig.d.ts +2 -2
- package/dist/types/index.d.ts +3 -1
- package/dist/utils/index.d.ts +19 -1
- package/package.json +1 -1
- package/src/dubhe.ts +353 -418
- package/src/libs/suiInteractor/defaultConfig.ts +2 -2
- package/src/types/index.ts +3 -1
- package/src/utils/index.ts +24 -1
package/dist/dubhe.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
2
|
import type { SuiTransactionBlockResponse, DevInspectResults, SuiMoveNormalizedModules, SuiObjectData } from '@mysten/sui/client';
|
|
3
3
|
import { SuiAccountManager } from './libs/suiAccountManager';
|
|
4
4
|
import { SuiTx } from './libs/suiTxBuilder';
|
|
@@ -24,9 +24,12 @@ export declare class Dubhe {
|
|
|
24
24
|
contractFactory: SuiContractFactory;
|
|
25
25
|
dubheChannelClient: DubheChannelClient;
|
|
26
26
|
packageId: string | undefined;
|
|
27
|
+
/** Fully-qualified Move type string for this DApp's DappKey, e.g. `<64-hex>::dapp_key::DappKey`. */
|
|
28
|
+
dappKey: string | undefined;
|
|
27
29
|
metadata: SuiMoveNormalizedModules | undefined;
|
|
28
30
|
projectName: string | undefined;
|
|
29
31
|
frameworkPackageId: string | undefined;
|
|
32
|
+
dappStorageId: string | undefined;
|
|
30
33
|
/**
|
|
31
34
|
* Support the following ways to init the DubheClient:
|
|
32
35
|
* 1. mnemonics
|
|
@@ -42,7 +45,7 @@ export declare class Dubhe {
|
|
|
42
45
|
* @param channelUrl, the base URL for Dubhe Channel API, optional
|
|
43
46
|
* @param frameworkPackageId, the published package ID of the dubhe framework, required for proxy operations
|
|
44
47
|
*/
|
|
45
|
-
constructor({ mnemonics, secretKey, networkType, fullnodeUrls, packageId, metadata, channelUrl, frameworkPackageId }?: DubheParams);
|
|
48
|
+
constructor({ mnemonics, secretKey, networkType, fullnodeUrls, packageId, metadata, channelUrl, frameworkPackageId, dappStorageId }?: DubheParams);
|
|
46
49
|
get query(): MapMoudleFuncQuery;
|
|
47
50
|
get tx(): MapMoudleFuncTx;
|
|
48
51
|
get object(): MapObjectStruct;
|
|
@@ -65,7 +68,7 @@ export declare class Dubhe {
|
|
|
65
68
|
* it will generate signer from the mnemonic with the given derivePathParams.
|
|
66
69
|
* @param derivePathParams, such as { accountIndex: 2, isExternal: false, addressIndex: 10 }, comply with the BIP44 standard
|
|
67
70
|
*/
|
|
68
|
-
getSigner(derivePathParams?: DerivePathParams): import("@mysten/sui/keypairs/ed25519").Ed25519Keypair;
|
|
71
|
+
getSigner(derivePathParams?: DerivePathParams): import("@mysten/sui/dist/cjs/keypairs/ed25519").Ed25519Keypair;
|
|
69
72
|
/**
|
|
70
73
|
* @description Switch the current account with the given derivePathParams
|
|
71
74
|
* @param derivePathParams, such as { accountIndex: 2, isExternal: false, addressIndex: 10 }, comply with the BIP44 standard
|
|
@@ -78,6 +81,25 @@ export declare class Dubhe {
|
|
|
78
81
|
getAddress(derivePathParams?: DerivePathParams): string;
|
|
79
82
|
currentAddress(): string;
|
|
80
83
|
getPackageId(): string;
|
|
84
|
+
/**
|
|
85
|
+
* Return the fully-qualified Move type string for this DApp's `DappKey`.
|
|
86
|
+
*
|
|
87
|
+
* The format matches what `std::type_name::get<DappKey>()` returns on-chain:
|
|
88
|
+
* `<64-char-zero-padded-address>::dapp_key::DappKey`
|
|
89
|
+
*
|
|
90
|
+
* Use this whenever you need to pass a type argument or build a `target`
|
|
91
|
+
* string that references the DApp's DappKey type.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* tx.moveCall({
|
|
96
|
+
* target: `${frameworkPackageId}::dapp_system::settle_writes`,
|
|
97
|
+
* typeArguments: [contract.getDappKey()],
|
|
98
|
+
* arguments: [...],
|
|
99
|
+
* });
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
getDappKey(): string | undefined;
|
|
81
103
|
getMetadata(): SuiMoveNormalizedModules | undefined;
|
|
82
104
|
getNetwork(): NetworkType | undefined;
|
|
83
105
|
getNetworkConfig(): NetworkConfig;
|
|
@@ -150,7 +172,7 @@ export declare class Dubhe {
|
|
|
150
172
|
* { onMessage: (data) => console.log(data) }
|
|
151
173
|
* );
|
|
152
174
|
*/
|
|
153
|
-
subscribeChannelTable({ packageId, account, table, key }?: {
|
|
175
|
+
subscribeChannelTable({ packageId: _packageId, account, table, key }?: {
|
|
154
176
|
packageId?: string;
|
|
155
177
|
account?: string;
|
|
156
178
|
table?: string;
|
|
@@ -224,244 +246,154 @@ export declare class Dubhe {
|
|
|
224
246
|
entity_key_from_address_with_u256(objectId: string, x: number): Promise<string | undefined>;
|
|
225
247
|
entity_key_from_u256(x: number): Promise<string>;
|
|
226
248
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* Useful for reading `frameworkPackageId` without instantiating a full client:
|
|
230
|
-
*
|
|
231
|
-
* ```ts
|
|
232
|
-
* const { frameworkPackageId } = Dubhe.getDefaultConfig('testnet');
|
|
233
|
-
* // → '0x8817b...' (known constant for testnet/mainnet)
|
|
234
|
-
* // → undefined (for localnet/devnet — supply after local deployment)
|
|
235
|
-
* ```
|
|
236
|
-
*/
|
|
237
|
-
static getDefaultConfig(networkType: NetworkType): NetworkConfig;
|
|
238
|
-
/**
|
|
239
|
-
* Derive the Sui address that corresponds to a raw Ed25519 public key.
|
|
240
|
-
*
|
|
241
|
-
* Matches the on-chain `derive_sui_address_from_pubkey` helper in
|
|
242
|
-
* `proxy_system.move`:
|
|
243
|
-
* address = SHA3-256( [0x00] || publicKey )
|
|
244
|
-
* where 0x00 is the Ed25519 scheme flag.
|
|
245
|
-
*
|
|
246
|
-
* @param publicKey Raw 32-byte Ed25519 public key
|
|
247
|
-
* @returns 64-character lowercase hex string (without 0x prefix), matching
|
|
248
|
-
* the format returned by Move's `address::to_ascii_string()`
|
|
249
|
-
*/
|
|
250
|
-
deriveSuiAddressFromEd25519PublicKey(publicKey: Uint8Array): string;
|
|
251
|
-
/**
|
|
252
|
-
* Build the canonical proxy registration message.
|
|
249
|
+
* Call the DApp's generated `user_storage_init::init_user_storage` entry function,
|
|
250
|
+
* which creates and shares a `UserStorage` object for the signer.
|
|
253
251
|
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
252
|
+
* Each DApp exposes this entry point under its own package ID.
|
|
253
|
+
* On Sui, the `UserStorage` object is shared immediately so all transactions
|
|
254
|
+
* can reference it without knowing the object ID in advance.
|
|
256
255
|
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
* @param ownerAddress Owner wallet's Sui address (with or without 0x prefix)
|
|
260
|
-
* @param proxyPublicKey Raw 32-byte Ed25519 public key of the proxy wallet
|
|
261
|
-
* @param expiresAt Expiry time — either a `Date` object or a millisecond
|
|
262
|
-
* timestamp number (e.g. `Date.now() + 86_400_000`)
|
|
263
|
-
* @param dappKeyType Full DappKey type string — defaults to
|
|
264
|
-
* `<packageId>::dapp_key::DappKey`
|
|
265
|
-
*/
|
|
266
|
-
buildProxyMessage({ ownerAddress, proxyPublicKey, expiresAt, dappKeyType }: {
|
|
267
|
-
ownerAddress: string;
|
|
268
|
-
proxyPublicKey: Uint8Array;
|
|
269
|
-
expiresAt: number | Date;
|
|
270
|
-
dappKeyType?: string;
|
|
271
|
-
}): Uint8Array;
|
|
272
|
-
/**
|
|
273
|
-
* Sign the proxy registration message using this client's current account.
|
|
274
|
-
*
|
|
275
|
-
* The proxy wallet creates a Dubhe instance with its own secret key and calls
|
|
276
|
-
* this method to produce the `publicKey` and `signature` that the owner then
|
|
277
|
-
* passes to `createProxy`.
|
|
278
|
-
*
|
|
279
|
-
* @param ownerAddress Sui address of the owner wallet
|
|
280
|
-
* @param expiresAt Expiry time — either a `Date` object or a millisecond
|
|
281
|
-
* timestamp number (e.g. `new Date(Date.now() + 86_400_000)`)
|
|
282
|
-
* @param dappKeyType Optional DApp key type override
|
|
283
|
-
* @returns `{ publicKey, signature, message }` — all as `Uint8Array`
|
|
284
|
-
*/
|
|
285
|
-
signProxyMessage({ ownerAddress, expiresAt, dappKeyType }: {
|
|
286
|
-
ownerAddress: string;
|
|
287
|
-
expiresAt: number | Date;
|
|
288
|
-
dappKeyType?: string;
|
|
289
|
-
}): Promise<{
|
|
290
|
-
publicKey: Uint8Array;
|
|
291
|
-
signature: Uint8Array;
|
|
292
|
-
message: Uint8Array;
|
|
293
|
-
}>;
|
|
294
|
-
/**
|
|
295
|
-
* Register a proxy wallet binding on-chain.
|
|
296
|
-
*
|
|
297
|
-
* Follows the same `tx` + `isRaw` convention as `contract.tx.*`:
|
|
298
|
-
* - `isRaw: true` — appends the Move call to the provided `tx` and returns
|
|
299
|
-
* a `TransactionResult`. The caller controls signing and submission.
|
|
300
|
-
* Useful for wallet-based signers (e.g. `useSignAndExecuteTransaction`).
|
|
301
|
-
* - `isRaw` omitted — creates a fresh `Transaction` internally, signs with
|
|
302
|
-
* the Dubhe instance's own keypair, and submits automatically.
|
|
303
|
-
*
|
|
304
|
-
* The current signer (owner) submits this transaction. The proxy wallet must
|
|
305
|
-
* have already signed the canonical message via `signProxyMessage`, producing
|
|
306
|
-
* the `publicKey` and `signature` parameters.
|
|
307
|
-
*
|
|
308
|
-
* Calls `<frameworkPackageId>::proxy_system::create_proxy<DappKey>`.
|
|
309
|
-
*
|
|
310
|
-
* @example Wallet signer (browser dApp)
|
|
311
|
-
* ```typescript
|
|
312
|
-
* const { publicKey, signature } = await proxyDubhe.signProxyMessage({ ownerAddress, expiresAt });
|
|
313
|
-
* const tx = new Transaction();
|
|
314
|
-
* await proxyDubhe.createProxy({ tx, dappHubId, publicKey, signature, expiresAt, isRaw: true });
|
|
315
|
-
* await signAndExecuteTransaction({ transaction: tx.serialize(), chain: `sui:${network}` });
|
|
316
|
-
* ```
|
|
317
|
-
*
|
|
318
|
-
* @param tx Existing Transaction to append to (required when `isRaw: true`)
|
|
319
|
-
* @param dappHubId Object ID of the DappHub shared object
|
|
320
|
-
* @param publicKey Raw 32-byte Ed25519 public key of the proxy wallet
|
|
321
|
-
* @param signature 64-byte Ed25519 signature from the proxy wallet
|
|
322
|
-
* @param expiresAt Expiry time — either a `Date` object or a millisecond timestamp
|
|
323
|
-
* @param isRaw When true, appends the call and returns without submitting
|
|
324
|
-
* @param frameworkPackageId Override the dubhe framework package ID
|
|
325
|
-
* @param dappKeyType Override the DApp key type string
|
|
256
|
+
* @param dappHubId Object ID of the DappHub shared object
|
|
257
|
+
* @param dappStorageId Object ID of the DApp's DappStorage shared object
|
|
326
258
|
*/
|
|
327
|
-
|
|
328
|
-
tx?: Transaction;
|
|
259
|
+
initUserStorage({ dappHubId, dappStorageId: dappStorageIdParam, derivePathParams, onSuccess, onError }: {
|
|
329
260
|
dappHubId: string;
|
|
330
|
-
|
|
331
|
-
signature: Uint8Array;
|
|
332
|
-
expiresAt: number | Date;
|
|
333
|
-
isRaw?: boolean;
|
|
334
|
-
frameworkPackageId?: string;
|
|
335
|
-
dappKeyType?: string;
|
|
261
|
+
dappStorageId?: string;
|
|
336
262
|
derivePathParams?: DerivePathParams;
|
|
337
263
|
onSuccess?: (result: SuiTransactionBlockResponse) => void | Promise<void>;
|
|
338
264
|
onError?: (error: Error) => void | Promise<void>;
|
|
339
|
-
}): Promise<SuiTransactionBlockResponse
|
|
265
|
+
}): Promise<SuiTransactionBlockResponse>;
|
|
340
266
|
/**
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
* Follows the same `tx` + `isRaw` convention as `contract.tx.*`:
|
|
344
|
-
* - `isRaw: true` — appends the Move call to the provided `tx` and returns
|
|
345
|
-
* a `TransactionResult`. The caller controls signing and submission.
|
|
346
|
-
* Useful for wallet-based signers (e.g. `useSignAndExecuteTransaction`).
|
|
347
|
-
* - `isRaw` omitted — creates a fresh `Transaction` internally, signs with
|
|
348
|
-
* the Dubhe instance's own keypair, and submits automatically.
|
|
267
|
+
* Activate a session key for the signer's `UserStorage`.
|
|
349
268
|
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
* to re-establish an expired proxy.
|
|
269
|
+
* The signer must be the `canonical_owner` of the `UserStorage` object.
|
|
270
|
+
* Calls `<frameworkPackageId>::dapp_system::activate_session<DappKey>`.
|
|
353
271
|
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
* @
|
|
357
|
-
*
|
|
358
|
-
* const tx = new Transaction();
|
|
359
|
-
* await proxyDubhe.extendProxy({ tx, dappHubId, proxyAddress, newExpiresAt, isRaw: true });
|
|
360
|
-
* await signAndExecuteTransaction({ transaction: tx.serialize(), chain: `sui:${network}` });
|
|
361
|
-
* ```
|
|
272
|
+
* @param userStorageId Object ID of the UserStorage to activate a session for
|
|
273
|
+
* @param sessionWallet Sui address of the session wallet
|
|
274
|
+
* @param durationMs Session duration in milliseconds ([60_000, 604_800_000])
|
|
275
|
+
* @param clockObjectId Object ID of the Sui Clock (default: 0x6)
|
|
362
276
|
*/
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
isRaw?: boolean;
|
|
369
|
-
frameworkPackageId?: string;
|
|
370
|
-
dappKeyType?: string;
|
|
277
|
+
activateSession({ userStorageId, sessionWallet, durationMs, clockObjectId, derivePathParams, onSuccess, onError }: {
|
|
278
|
+
userStorageId: string;
|
|
279
|
+
sessionWallet: string;
|
|
280
|
+
durationMs: number;
|
|
281
|
+
clockObjectId?: string;
|
|
371
282
|
derivePathParams?: DerivePathParams;
|
|
372
283
|
onSuccess?: (result: SuiTransactionBlockResponse) => void | Promise<void>;
|
|
373
284
|
onError?: (error: Error) => void | Promise<void>;
|
|
374
|
-
}): Promise<SuiTransactionBlockResponse
|
|
285
|
+
}): Promise<SuiTransactionBlockResponse>;
|
|
375
286
|
/**
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* Follows the same `tx` + `isRaw` convention as `contract.tx.*`:
|
|
379
|
-
* - `isRaw: true` — appends the Move call to the provided `tx` and returns
|
|
380
|
-
* a `TransactionResult`. The caller controls signing and submission.
|
|
381
|
-
* - `isRaw` omitted — creates a fresh `Transaction`, signs with this
|
|
382
|
-
* instance's keypair, and submits automatically.
|
|
287
|
+
* Deactivate the current session key on a `UserStorage`.
|
|
383
288
|
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
289
|
+
* Allowed callers:
|
|
290
|
+
* - The `canonical_owner` (revoke at any time).
|
|
291
|
+
* - The session key itself (voluntary sign-out).
|
|
292
|
+
* - Anyone, once the session has expired.
|
|
386
293
|
*
|
|
387
|
-
* Calls `<frameworkPackageId>::
|
|
294
|
+
* Calls `<frameworkPackageId>::dapp_system::deactivate_session<DappKey>`.
|
|
388
295
|
*
|
|
389
|
-
* @
|
|
390
|
-
* ```typescript
|
|
391
|
-
* const tx = new Transaction();
|
|
392
|
-
* await proxyDubhe.removeProxy({ tx, dappHubId, proxyAddress, isRaw: true });
|
|
393
|
-
* await signAndExecuteTransaction({ transaction: tx.serialize(), chain: `sui:${network}` });
|
|
394
|
-
* ```
|
|
296
|
+
* @param userStorageId Object ID of the UserStorage to deactivate the session on
|
|
395
297
|
*/
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
dappHubId: string;
|
|
399
|
-
proxyAddress: string;
|
|
400
|
-
isRaw?: boolean;
|
|
401
|
-
frameworkPackageId?: string;
|
|
402
|
-
dappKeyType?: string;
|
|
298
|
+
deactivateSession({ userStorageId, derivePathParams, onSuccess, onError }: {
|
|
299
|
+
userStorageId: string;
|
|
403
300
|
derivePathParams?: DerivePathParams;
|
|
404
301
|
onSuccess?: (result: SuiTransactionBlockResponse) => void | Promise<void>;
|
|
405
302
|
onError?: (error: Error) => void | Promise<void>;
|
|
406
|
-
}): Promise<SuiTransactionBlockResponse
|
|
303
|
+
}): Promise<SuiTransactionBlockResponse>;
|
|
407
304
|
/**
|
|
408
|
-
*
|
|
305
|
+
* Look up the `UserStorage` object ID for the given address in this DApp.
|
|
409
306
|
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
307
|
+
* Scans the transaction history for `user_storage_init::init_user_storage`
|
|
308
|
+
* calls from the given address and extracts the created `UserStorage` object
|
|
309
|
+
* ID from the transaction's object changes.
|
|
412
310
|
*
|
|
413
|
-
*
|
|
311
|
+
* Returns the object ID on success, or `null` when:
|
|
312
|
+
* - `packageId` or `frameworkPackageId` is not set.
|
|
313
|
+
* - The user has not yet called `initUserStorage`.
|
|
414
314
|
*
|
|
415
|
-
* @param
|
|
416
|
-
* @param proxyAddress Sui address of the proxy wallet (with or without 0x)
|
|
417
|
-
* @param clockObjectId Object ID of the Sui Clock (default: 0x6)
|
|
418
|
-
* @returns `true` if the proxy binding exists and `clock < expires_at`
|
|
315
|
+
* @param userAddress Sui address to look up (with or without 0x prefix).
|
|
419
316
|
*/
|
|
420
|
-
|
|
421
|
-
dappHubId: string;
|
|
422
|
-
proxyAddress: string;
|
|
423
|
-
clockObjectId?: string;
|
|
424
|
-
frameworkPackageId?: string;
|
|
425
|
-
dappKeyType?: string;
|
|
426
|
-
}): Promise<boolean>;
|
|
317
|
+
getUserStorageId(userAddress: string): Promise<string | null>;
|
|
427
318
|
/**
|
|
428
|
-
*
|
|
319
|
+
* Fetch and return the on-chain fields of a `UserStorage` shared object.
|
|
429
320
|
*
|
|
430
|
-
*
|
|
321
|
+
* The returned object mirrors Move's `UserStorage` struct plus two
|
|
322
|
+
* convenience fields computed from the raw counters:
|
|
323
|
+
* - `unsettled_count` = write_count − settled_count
|
|
324
|
+
* - `unsettled_bytes` = write_bytes − settled_bytes
|
|
431
325
|
*
|
|
432
|
-
*
|
|
326
|
+
* @param userStorageId Object ID of the UserStorage to inspect.
|
|
327
|
+
*/
|
|
328
|
+
getUserStorageFields(userStorageId: string): Promise<{
|
|
329
|
+
objectId: string;
|
|
330
|
+
dapp_key: string;
|
|
331
|
+
canonical_owner: string;
|
|
332
|
+
session_key: string;
|
|
333
|
+
session_expires_at: bigint;
|
|
334
|
+
write_count: bigint;
|
|
335
|
+
settled_count: bigint;
|
|
336
|
+
write_bytes: bigint;
|
|
337
|
+
settled_bytes: bigint;
|
|
338
|
+
unsettled_count: bigint;
|
|
339
|
+
unsettled_bytes: bigint;
|
|
340
|
+
}>;
|
|
341
|
+
/**
|
|
342
|
+
* Fetch and return the on-chain fields of a `DappStorage` shared object.
|
|
433
343
|
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
* @
|
|
344
|
+
* Covers the full metadata + fee/credit subset of the Move struct.
|
|
345
|
+
*
|
|
346
|
+
* @param dappStorageId Object ID of the DappStorage to inspect.
|
|
437
347
|
*/
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
348
|
+
getDappStorageFields(dappStorageId: string): Promise<{
|
|
349
|
+
objectId: string;
|
|
350
|
+
dapp_key: string;
|
|
351
|
+
name: string;
|
|
352
|
+
description: string;
|
|
353
|
+
website_url: string;
|
|
354
|
+
admin: string;
|
|
355
|
+
version: number;
|
|
356
|
+
paused: boolean;
|
|
357
|
+
free_credit: bigint;
|
|
358
|
+
free_credit_expires_at: bigint;
|
|
359
|
+
credit_pool: bigint;
|
|
360
|
+
min_credit_to_unsuspend: bigint;
|
|
361
|
+
suspended: boolean;
|
|
362
|
+
total_settled: bigint;
|
|
363
|
+
base_fee_per_write: bigint;
|
|
364
|
+
bytes_fee_per_byte: bigint;
|
|
365
|
+
}>;
|
|
444
366
|
/**
|
|
445
|
-
*
|
|
367
|
+
* Settle accumulated write debt for a user.
|
|
446
368
|
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
369
|
+
* Calls `<frameworkPackageId>::dapp_system::settle_writes<DappKey>` with the
|
|
370
|
+
* given DappHub, DappStorage, and UserStorage objects.
|
|
449
371
|
*
|
|
450
|
-
*
|
|
372
|
+
* This is safe to prepend to any PTB — the framework function never aborts
|
|
373
|
+
* due to insufficient credit; it silently skips or partially settles.
|
|
451
374
|
*
|
|
452
|
-
* @param dappHubId
|
|
453
|
-
* @param
|
|
454
|
-
* @
|
|
455
|
-
* (with 0x prefix) and `expiresAt` is the expiry timestamp in milliseconds,
|
|
456
|
-
* or `null` if no binding record exists.
|
|
375
|
+
* @param dappHubId Object ID of the DappHub shared object.
|
|
376
|
+
* @param dappStorageId Object ID of the DApp's DappStorage shared object.
|
|
377
|
+
* @param userStorageId Object ID of the user's UserStorage shared object.
|
|
457
378
|
*/
|
|
458
|
-
|
|
379
|
+
settleWrites({ dappHubId, dappStorageId: dappStorageIdParam, userStorageId, derivePathParams, onSuccess, onError }: {
|
|
459
380
|
dappHubId: string;
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
381
|
+
dappStorageId?: string;
|
|
382
|
+
userStorageId: string;
|
|
383
|
+
derivePathParams?: DerivePathParams;
|
|
384
|
+
onSuccess?: (result: SuiTransactionBlockResponse) => void | Promise<void>;
|
|
385
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
386
|
+
}): Promise<SuiTransactionBlockResponse>;
|
|
387
|
+
/**
|
|
388
|
+
* Return the default network configuration for the given network type.
|
|
389
|
+
*
|
|
390
|
+
* Useful for reading `frameworkPackageId` without instantiating a full client:
|
|
391
|
+
*
|
|
392
|
+
* ```ts
|
|
393
|
+
* const { frameworkPackageId } = Dubhe.getDefaultConfig('testnet');
|
|
394
|
+
* // → '0x8817b...' (known constant for testnet/mainnet)
|
|
395
|
+
* // → undefined (for localnet/devnet — supply after local deployment)
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
static getDefaultConfig(networkType: NetworkType): NetworkConfig;
|
|
467
399
|
}
|