@toon-protocol/client 4.1.1 → 4.2.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/{chunk-SS3GGBUE.js → chunk-6VD2Y62D.js} +22 -5
- package/dist/chunk-6VD2Y62D.js.map +1 -0
- package/dist/cli/main.js +1 -1
- package/dist/{client-CTOUNPZD.js → client-L75P6SOK.js} +2 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-SS3GGBUE.js.map +0 -1
- /package/dist/{client-CTOUNPZD.js.map → client-L75P6SOK.js.map} +0 -0
|
@@ -3839,7 +3839,7 @@ var PERMIT2_DEPOSIT_COLLECTOR_ADDRESS = "0x4020425FAf3B746C082C2f942b4E5159887B0
|
|
|
3839
3839
|
var PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
3840
3840
|
var MIN_WITHDRAW_DELAY_SECONDS = 15 * 60;
|
|
3841
3841
|
var MAX_WITHDRAW_DELAY_SECONDS = 30 * 24 * 60 * 60;
|
|
3842
|
-
var MAX_VOUCHER_AMOUNT = 2n **
|
|
3842
|
+
var MAX_VOUCHER_AMOUNT = 2n ** 128n - 1n;
|
|
3843
3843
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
3844
3844
|
var CHANNEL_CONFIG_TYPES = {
|
|
3845
3845
|
ChannelConfig: [
|
|
@@ -3956,7 +3956,7 @@ function batchChannelId(config, chainId) {
|
|
|
3956
3956
|
function assertVoucherAmount(amount) {
|
|
3957
3957
|
if (amount < 0n || amount > MAX_VOUCHER_AMOUNT) {
|
|
3958
3958
|
throw new ValidationError(
|
|
3959
|
-
`voucher amount ${amount} is outside 0..2^
|
|
3959
|
+
`voucher amount ${amount} is outside 0..2^128-1, the uint128 a voucher carries`
|
|
3960
3960
|
);
|
|
3961
3961
|
}
|
|
3962
3962
|
}
|
|
@@ -6497,7 +6497,9 @@ async function signErc20ApprovalGasSponsoring(params) {
|
|
|
6497
6497
|
}
|
|
6498
6498
|
};
|
|
6499
6499
|
}
|
|
6500
|
-
|
|
6500
|
+
var VISIBLE_WITHIN_MS = 3e4;
|
|
6501
|
+
var POLL_INTERVAL_MS = 1e3;
|
|
6502
|
+
async function approvePermit2(wallet, token, seen) {
|
|
6501
6503
|
const hash = await wallet.writeContract({
|
|
6502
6504
|
address: getAddress2(token),
|
|
6503
6505
|
abi: ERC20_PERMIT2_ABI,
|
|
@@ -6505,6 +6507,17 @@ async function approvePermit2(wallet, token) {
|
|
|
6505
6507
|
args: [PERMIT2_ADDRESS, maxUint256]
|
|
6506
6508
|
});
|
|
6507
6509
|
await landed(wallet, hash, "the Permit2 approval");
|
|
6510
|
+
if (seen) {
|
|
6511
|
+
const deadline = Date.now() + VISIBLE_WITHIN_MS;
|
|
6512
|
+
while (await permit2Allowance(seen.reader, token, seen.owner) < seen.atLeast) {
|
|
6513
|
+
if (Date.now() >= deadline) {
|
|
6514
|
+
throw new NetworkError(
|
|
6515
|
+
`the Permit2 approval ${hash} landed, but the RPC did not show it within ${VISIBLE_WITHIN_MS / 1e3} s`
|
|
6516
|
+
);
|
|
6517
|
+
}
|
|
6518
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
6519
|
+
}
|
|
6520
|
+
}
|
|
6508
6521
|
return hash;
|
|
6509
6522
|
}
|
|
6510
6523
|
function erc3009CollectorData(payload) {
|
|
@@ -7191,7 +7204,11 @@ var BatchSettlementPayer = class {
|
|
|
7191
7204
|
);
|
|
7192
7205
|
}
|
|
7193
7206
|
await this.payOwnGas(evm, `a one-time Permit2 approval of ${offer.asset}`, facilitatorUrl);
|
|
7194
|
-
await approvePermit2(this.requireWallet(evm), offer.asset
|
|
7207
|
+
await approvePermit2(this.requireWallet(evm), offer.asset, {
|
|
7208
|
+
reader: evm.reader,
|
|
7209
|
+
owner: evm.account.address,
|
|
7210
|
+
atLeast: amount
|
|
7211
|
+
});
|
|
7195
7212
|
}
|
|
7196
7213
|
}
|
|
7197
7214
|
}
|
|
@@ -8731,4 +8748,4 @@ export {
|
|
|
8731
8748
|
toEnvelopeRequest,
|
|
8732
8749
|
ToonClient
|
|
8733
8750
|
};
|
|
8734
|
-
//# sourceMappingURL=chunk-
|
|
8751
|
+
//# sourceMappingURL=chunk-6VD2Y62D.js.map
|