@toon-protocol/client 4.1.1 → 4.1.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/{chunk-SS3GGBUE.js → chunk-2FCRHYFJ.js} +20 -3
- package/dist/{chunk-SS3GGBUE.js.map → chunk-2FCRHYFJ.js.map} +1 -1
- package/dist/cli/main.js +1 -1
- package/dist/{client-CTOUNPZD.js → client-66Z6WVBV.js} +2 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- /package/dist/{client-CTOUNPZD.js.map → client-66Z6WVBV.js.map} +0 -0
|
@@ -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-2FCRHYFJ.js.map
|