@unlink-xyz/react 0.1.3-canary.5e5993b → 0.1.3-canary.94ce361
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 +57 -72
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -55904,9 +55904,9 @@ function createWalletSDK(deps, options) {
|
|
|
55904
55904
|
}
|
|
55905
55905
|
},
|
|
55906
55906
|
balances: {
|
|
55907
|
-
async list(chainId
|
|
55907
|
+
async list(chainId) {
|
|
55908
55908
|
ensureChainId(chainId);
|
|
55909
|
-
const account =
|
|
55909
|
+
const account = await requireActiveAccount();
|
|
55910
55910
|
const notes = await stateStore.listNotes({
|
|
55911
55911
|
chainId,
|
|
55912
55912
|
mpk: formatUint256(account.masterPublicKey),
|
|
@@ -55914,15 +55914,15 @@ function createWalletSDK(deps, options) {
|
|
|
55914
55914
|
});
|
|
55915
55915
|
return computeBalances(notes);
|
|
55916
55916
|
},
|
|
55917
|
-
async get(chainId, token
|
|
55918
|
-
const balances = await this.list(chainId
|
|
55917
|
+
async get(chainId, token) {
|
|
55918
|
+
const balances = await this.list(chainId);
|
|
55919
55919
|
return balances[token.toLowerCase()] ?? 0n;
|
|
55920
55920
|
}
|
|
55921
55921
|
},
|
|
55922
55922
|
deposit: {
|
|
55923
55923
|
async request(params) {
|
|
55924
55924
|
ensureChainId(params.chainId);
|
|
55925
|
-
const account =
|
|
55925
|
+
const account = await requireActiveAccount();
|
|
55926
55926
|
const notes = params.deposits.map((d2) => {
|
|
55927
55927
|
const randomBytes5 = rng(32);
|
|
55928
55928
|
const random = BigInt(
|
|
@@ -55957,9 +55957,9 @@ function createWalletSDK(deps, options) {
|
|
|
55957
55957
|
}
|
|
55958
55958
|
},
|
|
55959
55959
|
history: {
|
|
55960
|
-
async list(chainId, options2
|
|
55960
|
+
async list(chainId, options2) {
|
|
55961
55961
|
ensureChainId(chainId);
|
|
55962
|
-
const account =
|
|
55962
|
+
const account = await requireActiveAccount();
|
|
55963
55963
|
return historyService.getHistory({
|
|
55964
55964
|
chainId,
|
|
55965
55965
|
mpk: formatUint256(account.masterPublicKey),
|
|
@@ -55984,9 +55984,9 @@ function createWalletSDK(deps, options) {
|
|
|
55984
55984
|
});
|
|
55985
55985
|
await historyService.rebuildHistory({ chainId: note.chainId, mpk });
|
|
55986
55986
|
},
|
|
55987
|
-
async list(chainId
|
|
55987
|
+
async list(chainId) {
|
|
55988
55988
|
ensureChainId(chainId);
|
|
55989
|
-
const account =
|
|
55989
|
+
const account = await requireActiveAccount();
|
|
55990
55990
|
return stateStore.listNotes({
|
|
55991
55991
|
chainId,
|
|
55992
55992
|
mpk: formatUint256(account.masterPublicKey),
|
|
@@ -56259,8 +56259,7 @@ var UnlinkWallet = class _UnlinkWallet {
|
|
|
56259
56259
|
chainId: this.chainId,
|
|
56260
56260
|
poolAddress: this.poolAddress,
|
|
56261
56261
|
depositor: params.depositor,
|
|
56262
|
-
deposits: params.deposits
|
|
56263
|
-
account: params.account
|
|
56262
|
+
deposits: params.deposits
|
|
56264
56263
|
});
|
|
56265
56264
|
}
|
|
56266
56265
|
/** Wait for a deposit to be confirmed on-chain. */
|
|
@@ -56271,71 +56270,57 @@ var UnlinkWallet = class _UnlinkWallet {
|
|
|
56271
56270
|
* Execute a private transfer (1 or more recipients).
|
|
56272
56271
|
* Handles note selection, circuit selection, and proof generation automatically.
|
|
56273
56272
|
*/
|
|
56274
|
-
async transfer(params
|
|
56275
|
-
return this.sdk.transfer.send(
|
|
56276
|
-
|
|
56277
|
-
|
|
56278
|
-
|
|
56279
|
-
|
|
56280
|
-
},
|
|
56281
|
-
overrides
|
|
56282
|
-
);
|
|
56273
|
+
async transfer(params) {
|
|
56274
|
+
return this.sdk.transfer.send({
|
|
56275
|
+
chainId: this.chainId,
|
|
56276
|
+
poolAddress: this.poolAddress,
|
|
56277
|
+
transfers: params.transfers
|
|
56278
|
+
});
|
|
56283
56279
|
}
|
|
56284
56280
|
/**
|
|
56285
56281
|
* Get a transfer plan without executing (for preview/confirmation UIs).
|
|
56286
56282
|
*/
|
|
56287
|
-
async planTransfer(params
|
|
56288
|
-
return this.sdk.transfer.plan(
|
|
56289
|
-
|
|
56290
|
-
|
|
56291
|
-
|
|
56292
|
-
|
|
56293
|
-
},
|
|
56294
|
-
account
|
|
56295
|
-
);
|
|
56283
|
+
async planTransfer(params) {
|
|
56284
|
+
return this.sdk.transfer.plan({
|
|
56285
|
+
chainId: this.chainId,
|
|
56286
|
+
poolAddress: this.poolAddress,
|
|
56287
|
+
transfers: params.transfers
|
|
56288
|
+
});
|
|
56296
56289
|
}
|
|
56297
56290
|
/** Execute a pre-built transfer plan. */
|
|
56298
|
-
async executeTransfer(plans
|
|
56299
|
-
return this.sdk.transfer.execute(
|
|
56300
|
-
|
|
56301
|
-
|
|
56302
|
-
|
|
56303
|
-
);
|
|
56291
|
+
async executeTransfer(plans) {
|
|
56292
|
+
return this.sdk.transfer.execute(plans, {
|
|
56293
|
+
chainId: this.chainId,
|
|
56294
|
+
poolAddress: this.poolAddress
|
|
56295
|
+
});
|
|
56304
56296
|
}
|
|
56305
56297
|
/**
|
|
56306
56298
|
* Execute a withdrawal (1 or more recipients).
|
|
56307
56299
|
* Handles note selection, circuit selection, and proof generation automatically.
|
|
56308
56300
|
*/
|
|
56309
|
-
async withdraw(params
|
|
56310
|
-
return this.sdk.withdraw.send(
|
|
56311
|
-
|
|
56312
|
-
|
|
56313
|
-
|
|
56314
|
-
|
|
56315
|
-
},
|
|
56316
|
-
overrides
|
|
56317
|
-
);
|
|
56301
|
+
async withdraw(params) {
|
|
56302
|
+
return this.sdk.withdraw.send({
|
|
56303
|
+
chainId: this.chainId,
|
|
56304
|
+
poolAddress: this.poolAddress,
|
|
56305
|
+
withdrawals: params.withdrawals
|
|
56306
|
+
});
|
|
56318
56307
|
}
|
|
56319
56308
|
/**
|
|
56320
56309
|
* Get a withdrawal plan without executing (for preview/confirmation UIs).
|
|
56321
56310
|
*/
|
|
56322
|
-
async planWithdraw(params
|
|
56323
|
-
return this.sdk.withdraw.plan(
|
|
56324
|
-
|
|
56325
|
-
|
|
56326
|
-
|
|
56327
|
-
|
|
56328
|
-
},
|
|
56329
|
-
account
|
|
56330
|
-
);
|
|
56311
|
+
async planWithdraw(params) {
|
|
56312
|
+
return this.sdk.withdraw.plan({
|
|
56313
|
+
chainId: this.chainId,
|
|
56314
|
+
poolAddress: this.poolAddress,
|
|
56315
|
+
withdrawals: params.withdrawals
|
|
56316
|
+
});
|
|
56331
56317
|
}
|
|
56332
56318
|
/** Execute a pre-built withdrawal plan. */
|
|
56333
|
-
async executeWithdraw(plans
|
|
56334
|
-
return this.sdk.withdraw.execute(
|
|
56335
|
-
|
|
56336
|
-
|
|
56337
|
-
|
|
56338
|
-
);
|
|
56319
|
+
async executeWithdraw(plans) {
|
|
56320
|
+
return this.sdk.withdraw.execute(plans, {
|
|
56321
|
+
chainId: this.chainId,
|
|
56322
|
+
poolAddress: this.poolAddress
|
|
56323
|
+
});
|
|
56339
56324
|
}
|
|
56340
56325
|
/** Wait for a transfer or withdrawal to be confirmed on-chain. */
|
|
56341
56326
|
async confirmTransaction(relayId) {
|
|
@@ -56346,28 +56331,28 @@ var UnlinkWallet = class _UnlinkWallet {
|
|
|
56346
56331
|
* Get balance for a specific token (defaults to all tokens if no token specified).
|
|
56347
56332
|
* @param token Token address. If omitted, returns balance for all tokens via getBalances().
|
|
56348
56333
|
*/
|
|
56349
|
-
async getBalance(token
|
|
56350
|
-
return this.sdk.balances.get(this.chainId, token
|
|
56334
|
+
async getBalance(token) {
|
|
56335
|
+
return this.sdk.balances.get(this.chainId, token);
|
|
56351
56336
|
}
|
|
56352
56337
|
/** Get balances for all tokens. */
|
|
56353
|
-
async getBalances(
|
|
56354
|
-
return this.sdk.balances.list(this.chainId
|
|
56338
|
+
async getBalances() {
|
|
56339
|
+
return this.sdk.balances.list(this.chainId);
|
|
56355
56340
|
}
|
|
56356
56341
|
/** Get transaction history. */
|
|
56357
|
-
async getHistory(options
|
|
56358
|
-
return this.sdk.history.list(this.chainId, options
|
|
56342
|
+
async getHistory(options) {
|
|
56343
|
+
return this.sdk.history.list(this.chainId, options);
|
|
56359
56344
|
}
|
|
56360
|
-
/** Get UTXO notes for the active account
|
|
56361
|
-
async getNotes(
|
|
56362
|
-
return this.sdk.notes.list(this.chainId
|
|
56345
|
+
/** Get UTXO notes for the active account. */
|
|
56346
|
+
async getNotes() {
|
|
56347
|
+
return this.sdk.notes.list(this.chainId);
|
|
56363
56348
|
}
|
|
56364
56349
|
// ===== Sync =====
|
|
56365
56350
|
/**
|
|
56366
56351
|
* Sync notes from the blockchain.
|
|
56367
56352
|
* Automatically resolves the active account (no need to pass it).
|
|
56368
56353
|
*/
|
|
56369
|
-
async sync(options
|
|
56370
|
-
const account =
|
|
56354
|
+
async sync(options) {
|
|
56355
|
+
const account = await this.requireActiveAccount();
|
|
56371
56356
|
return this.sdk.sync.syncChain(this.chainId, account, options);
|
|
56372
56357
|
}
|
|
56373
56358
|
/** Start auto-sync at the given interval (default: 5000ms). */
|
|
@@ -56606,8 +56591,8 @@ function UnlinkProvider({
|
|
|
56606
56591
|
setState((prev2) => ({
|
|
56607
56592
|
...prev2,
|
|
56608
56593
|
accounts,
|
|
56609
|
-
activeAccount
|
|
56610
|
-
activeAccountIndex
|
|
56594
|
+
activeAccount,
|
|
56595
|
+
activeAccountIndex
|
|
56611
56596
|
}));
|
|
56612
56597
|
} catch (err) {
|
|
56613
56598
|
console.error("[UnlinkProvider] refreshAccounts error", err);
|