@4mica/sdk 1.2.5 → 1.2.6
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/contract.js +6 -5
- package/package.json +1 -1
package/dist/contract.js
CHANGED
|
@@ -136,13 +136,14 @@ class ContractGateway {
|
|
|
136
136
|
}
|
|
137
137
|
// Verify the allowance was actually set on-chain. The catch path above can
|
|
138
138
|
// leave allowance at 0 if the re-approve transaction fails silently.
|
|
139
|
-
// Read at
|
|
140
|
-
//
|
|
139
|
+
// Read at "latest" — waitForTransactionReceipt already confirmed the block,
|
|
140
|
+
// and many public RPCs reject eth_call at a specific recent blockNumber.
|
|
141
141
|
const account = this.walletClient.account;
|
|
142
142
|
if (account) {
|
|
143
|
-
const actual = (await erc20.read.allowance([
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
const actual = (await erc20.read.allowance([
|
|
144
|
+
account.address,
|
|
145
|
+
spender,
|
|
146
|
+
]));
|
|
146
147
|
if (actual < targetAllowance) {
|
|
147
148
|
throw new errors_1.ContractError(`ERC20 allowance verification failed: on-chain allowance is ${actual} but expected ${targetAllowance}. ` +
|
|
148
149
|
`Try calling approveErc20 again.`);
|