viem 2.57.17 → 2.57.18
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/CHANGELOG.md +80 -0
- package/_cjs/account-abstraction/actions/paymaster/getPaymasterData.js +4 -2
- package/_cjs/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
- package/_cjs/account-abstraction/actions/paymaster/getPaymasterStubData.js +6 -2
- package/_cjs/account-abstraction/actions/paymaster/getPaymasterStubData.js.map +1 -1
- package/_cjs/actions/ens/getEnsAddress.js +11 -1
- package/_cjs/actions/ens/getEnsAddress.js.map +1 -1
- package/_cjs/actions/index.js +5 -3
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/public/call.js +13 -2
- package/_cjs/actions/public/call.js.map +1 -1
- package/_cjs/actions/public/getLogs.js +18 -1
- package/_cjs/actions/public/getLogs.js.map +1 -1
- package/_cjs/actions/public/internal/isRangeError.js +18 -0
- package/_cjs/actions/public/internal/isRangeError.js.map +1 -0
- package/_cjs/actions/public/internal/watchTransport.js +24 -0
- package/_cjs/actions/public/internal/watchTransport.js.map +1 -0
- package/_cjs/actions/public/iterateLogs.js +48 -0
- package/_cjs/actions/public/iterateLogs.js.map +1 -0
- package/_cjs/actions/public/simulateContract.js +4 -4
- package/_cjs/actions/public/simulateContract.js.map +1 -1
- package/_cjs/actions/public/verifyHash.js +72 -39
- package/_cjs/actions/public/verifyHash.js.map +1 -1
- package/_cjs/actions/public/waitForTransactionReceipt.js +18 -1
- package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_cjs/actions/public/watchBlockHeaders.js +2 -10
- package/_cjs/actions/public/watchBlockHeaders.js.map +1 -1
- package/_cjs/actions/public/watchBlockNumber.js +3 -18
- package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
- package/_cjs/actions/public/watchBlocks.js +3 -18
- package/_cjs/actions/public/watchBlocks.js.map +1 -1
- package/_cjs/actions/public/watchContractEvent.js +5 -33
- package/_cjs/actions/public/watchContractEvent.js.map +1 -1
- package/_cjs/actions/public/watchEvent.js +5 -33
- package/_cjs/actions/public/watchEvent.js.map +1 -1
- package/_cjs/actions/wallet/prepareTransactionRequest.js +16 -3
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/celo/serializers.js +1 -1
- package/_cjs/celo/serializers.js.map +1 -1
- package/_cjs/clients/decorators/public.js +2 -0
- package/_cjs/clients/decorators/public.js.map +1 -1
- package/_cjs/constants/contracts.js +1 -1
- package/_cjs/constants/contracts.js.map +1 -1
- package/_cjs/errors/chain.js +2 -2
- package/_cjs/errors/chain.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js +5 -4
- package/_cjs/index.js.map +1 -1
- package/_cjs/op-stack/actions/buildProveWithdrawal.js +5 -5
- package/_cjs/op-stack/actions/buildProveWithdrawal.js.map +1 -1
- package/_cjs/op-stack/actions/getL2Output.js +13 -9
- package/_cjs/op-stack/actions/getL2Output.js.map +1 -1
- package/_cjs/op-stack/actions/waitToProve.js +1 -0
- package/_cjs/op-stack/actions/waitToProve.js.map +1 -1
- package/_cjs/tempo/Account.js +30 -0
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/actions/accessKey.js +1 -1
- package/_cjs/tempo/actions/accessKey.js.map +1 -1
- package/_cjs/tempo/actions/accounts.js +5 -5
- package/_cjs/tempo/actions/accounts.js.map +1 -1
- package/_cjs/tempo/actions/earn/deployment.js +1 -1
- package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
- package/_cjs/tempo/actions/earn.js +3 -3
- package/_cjs/tempo/actions/earn.js.map +1 -1
- package/_cjs/tempo/actions/propAmm.js +1 -1
- package/_cjs/tempo/actions/propAmm.js.map +1 -1
- package/_cjs/tempo/actions/token.js +10 -2
- package/_cjs/tempo/actions/token.js.map +1 -1
- package/_cjs/tempo/chainConfig.js +14 -0
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/internal/preAuthorized.js +214 -0
- package/_cjs/tempo/internal/preAuthorized.js.map +1 -0
- package/_cjs/tempo/internal/relay/feePayer.js +25 -7
- package/_cjs/tempo/internal/relay/feePayer.js.map +1 -1
- package/_cjs/utils/abi/decodeAbiParameters.js +33 -9
- package/_cjs/utils/abi/decodeAbiParameters.js.map +1 -1
- package/_cjs/utils/abi/encodeAbiParameters.js +5 -4
- package/_cjs/utils/abi/encodeAbiParameters.js.map +1 -1
- package/_cjs/utils/abi/encodePacked.js +4 -2
- package/_cjs/utils/abi/encodePacked.js.map +1 -1
- package/_cjs/utils/ccip.js +5 -1
- package/_cjs/utils/ccip.js.map +1 -1
- package/_cjs/utils/chain/getChainContractAddress.js +2 -2
- package/_cjs/utils/chain/getChainContractAddress.js.map +1 -1
- package/_cjs/utils/encoding/toBytes.js +5 -6
- package/_cjs/utils/encoding/toBytes.js.map +1 -1
- package/_cjs/utils/ens/avatar/utils.js +25 -5
- package/_cjs/utils/ens/avatar/utils.js.map +1 -1
- package/_cjs/utils/ens/localBatchGatewayRequest.js +13 -1
- package/_cjs/utils/ens/localBatchGatewayRequest.js.map +1 -1
- package/_cjs/utils/promise/createBatchScheduler.js +1 -1
- package/_cjs/utils/promise/createBatchScheduler.js.map +1 -1
- package/_cjs/utils/siwe/validateSiweMessage.js +5 -0
- package/_cjs/utils/siwe/validateSiweMessage.js.map +1 -1
- package/_cjs/zksync/actions/estimateFee.js +1 -1
- package/_cjs/zksync/actions/estimateFee.js.map +1 -1
- package/_cjs/zksync/actions/estimateGasL1ToL2.js +1 -1
- package/_cjs/zksync/actions/estimateGasL1ToL2.js.map +1 -1
- package/_cjs/zksync/actions/finalizeWithdrawal.js +3 -3
- package/_cjs/zksync/actions/finalizeWithdrawal.js.map +1 -1
- package/_cjs/zksync/actions/sendEip712Transaction.js +10 -2
- package/_cjs/zksync/actions/sendEip712Transaction.js.map +1 -1
- package/_cjs/zksync/actions/signEip712Transaction.js +2 -2
- package/_cjs/zksync/actions/signEip712Transaction.js.map +1 -1
- package/_esm/account-abstraction/actions/paymaster/getPaymasterData.js +4 -2
- package/_esm/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
- package/_esm/account-abstraction/actions/paymaster/getPaymasterStubData.js +6 -2
- package/_esm/account-abstraction/actions/paymaster/getPaymasterStubData.js.map +1 -1
- package/_esm/actions/ens/getEnsAddress.js +12 -1
- package/_esm/actions/ens/getEnsAddress.js.map +1 -1
- package/_esm/actions/index.js +1 -0
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/public/call.js +13 -2
- package/_esm/actions/public/call.js.map +1 -1
- package/_esm/actions/public/getLogs.js +18 -1
- package/_esm/actions/public/getLogs.js.map +1 -1
- package/_esm/actions/public/internal/isRangeError.js +19 -0
- package/_esm/actions/public/internal/isRangeError.js.map +1 -0
- package/_esm/actions/public/internal/watchTransport.js +22 -0
- package/_esm/actions/public/internal/watchTransport.js.map +1 -0
- package/_esm/actions/public/iterateLogs.js +84 -0
- package/_esm/actions/public/iterateLogs.js.map +1 -0
- package/_esm/actions/public/simulateContract.js +5 -4
- package/_esm/actions/public/simulateContract.js.map +1 -1
- package/_esm/actions/public/verifyHash.js +77 -40
- package/_esm/actions/public/verifyHash.js.map +1 -1
- package/_esm/actions/public/waitForTransactionReceipt.js +20 -1
- package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_esm/actions/public/watchBlockHeaders.js +2 -10
- package/_esm/actions/public/watchBlockHeaders.js.map +1 -1
- package/_esm/actions/public/watchBlockNumber.js +3 -18
- package/_esm/actions/public/watchBlockNumber.js.map +1 -1
- package/_esm/actions/public/watchBlocks.js +3 -18
- package/_esm/actions/public/watchBlocks.js.map +1 -1
- package/_esm/actions/public/watchContractEvent.js +4 -36
- package/_esm/actions/public/watchContractEvent.js.map +1 -1
- package/_esm/actions/public/watchEvent.js +4 -36
- package/_esm/actions/public/watchEvent.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js +17 -3
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/celo/serializers.js +1 -1
- package/_esm/celo/serializers.js.map +1 -1
- package/_esm/clients/decorators/public.js +2 -0
- package/_esm/clients/decorators/public.js.map +1 -1
- package/_esm/constants/contracts.js +1 -1
- package/_esm/constants/contracts.js.map +1 -1
- package/_esm/errors/chain.js +2 -2
- package/_esm/errors/chain.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/op-stack/actions/buildProveWithdrawal.js +5 -5
- package/_esm/op-stack/actions/buildProveWithdrawal.js.map +1 -1
- package/_esm/op-stack/actions/getL2Output.js +14 -9
- package/_esm/op-stack/actions/getL2Output.js.map +1 -1
- package/_esm/op-stack/actions/waitToProve.js +1 -0
- package/_esm/op-stack/actions/waitToProve.js.map +1 -1
- package/_esm/tempo/Account.js +33 -1
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/actions/accessKey.js +1 -1
- package/_esm/tempo/actions/accessKey.js.map +1 -1
- package/_esm/tempo/actions/accounts.js +5 -5
- package/_esm/tempo/actions/accounts.js.map +1 -1
- package/_esm/tempo/actions/earn/deployment.js +1 -1
- package/_esm/tempo/actions/earn/deployment.js.map +1 -1
- package/_esm/tempo/actions/earn.js +3 -3
- package/_esm/tempo/actions/earn.js.map +1 -1
- package/_esm/tempo/actions/propAmm.js +1 -1
- package/_esm/tempo/actions/propAmm.js.map +1 -1
- package/_esm/tempo/actions/token.js +10 -2
- package/_esm/tempo/actions/token.js.map +1 -1
- package/_esm/tempo/chainConfig.js +16 -0
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/internal/preAuthorized.js +244 -0
- package/_esm/tempo/internal/preAuthorized.js.map +1 -0
- package/_esm/tempo/internal/relay/feePayer.js +26 -7
- package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
- package/_esm/utils/abi/decodeAbiParameters.js +37 -9
- package/_esm/utils/abi/decodeAbiParameters.js.map +1 -1
- package/_esm/utils/abi/encodeAbiParameters.js +6 -4
- package/_esm/utils/abi/encodeAbiParameters.js.map +1 -1
- package/_esm/utils/abi/encodePacked.js +5 -2
- package/_esm/utils/abi/encodePacked.js.map +1 -1
- package/_esm/utils/ccip.js +8 -3
- package/_esm/utils/ccip.js.map +1 -1
- package/_esm/utils/chain/getChainContractAddress.js +2 -2
- package/_esm/utils/chain/getChainContractAddress.js.map +1 -1
- package/_esm/utils/encoding/toBytes.js +5 -6
- package/_esm/utils/encoding/toBytes.js.map +1 -1
- package/_esm/utils/ens/avatar/utils.js +26 -5
- package/_esm/utils/ens/avatar/utils.js.map +1 -1
- package/_esm/utils/ens/localBatchGatewayRequest.js +17 -1
- package/_esm/utils/ens/localBatchGatewayRequest.js.map +1 -1
- package/_esm/utils/promise/createBatchScheduler.js +2 -1
- package/_esm/utils/promise/createBatchScheduler.js.map +1 -1
- package/_esm/utils/siwe/validateSiweMessage.js +6 -0
- package/_esm/utils/siwe/validateSiweMessage.js.map +1 -1
- package/_esm/zksync/actions/estimateFee.js +1 -1
- package/_esm/zksync/actions/estimateFee.js.map +1 -1
- package/_esm/zksync/actions/estimateGasL1ToL2.js +1 -1
- package/_esm/zksync/actions/estimateGasL1ToL2.js.map +1 -1
- package/_esm/zksync/actions/finalizeWithdrawal.js +3 -3
- package/_esm/zksync/actions/finalizeWithdrawal.js.map +1 -1
- package/_esm/zksync/actions/sendEip712Transaction.js +12 -2
- package/_esm/zksync/actions/sendEip712Transaction.js.map +1 -1
- package/_esm/zksync/actions/signEip712Transaction.js +2 -2
- package/_esm/zksync/actions/signEip712Transaction.js.map +1 -1
- package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts.map +1 -1
- package/_types/account-abstraction/actions/paymaster/getPaymasterStubData.d.ts.map +1 -1
- package/_types/actions/ens/getEnsAddress.d.ts +2 -1
- package/_types/actions/ens/getEnsAddress.d.ts.map +1 -1
- package/_types/actions/index.d.ts +1 -0
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/public/call.d.ts.map +1 -1
- package/_types/actions/public/getLogs.d.ts +20 -2
- package/_types/actions/public/getLogs.d.ts.map +1 -1
- package/_types/actions/public/internal/isRangeError.d.ts +3 -0
- package/_types/actions/public/internal/isRangeError.d.ts.map +1 -0
- package/_types/actions/public/internal/watchTransport.d.ts +6 -0
- package/_types/actions/public/internal/watchTransport.d.ts.map +1 -0
- package/_types/actions/public/iterateLogs.d.ts +94 -0
- package/_types/actions/public/iterateLogs.d.ts.map +1 -0
- package/_types/actions/public/simulateContract.d.ts.map +1 -1
- package/_types/actions/public/verifyHash.d.ts +2 -1
- package/_types/actions/public/verifyHash.d.ts.map +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts +7 -2
- package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/_types/actions/public/watchBlockHeaders.d.ts.map +1 -1
- package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
- package/_types/actions/public/watchBlocks.d.ts.map +1 -1
- package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
- package/_types/actions/public/watchEvent.d.ts.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts +2 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/celo/serializers.d.ts.map +1 -1
- package/_types/clients/decorators/public.d.ts +33 -0
- package/_types/clients/decorators/public.d.ts.map +1 -1
- package/_types/constants/contracts.d.ts +1 -1
- package/_types/constants/contracts.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +2 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/op-stack/actions/getL2Output.d.ts +6 -0
- package/_types/op-stack/actions/getL2Output.d.ts.map +1 -1
- package/_types/op-stack/actions/waitToProve.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +5 -1
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/actions/earn/deployment.d.ts.map +1 -1
- package/_types/tempo/actions/propAmm.d.ts.map +1 -1
- package/_types/tempo/actions/token.d.ts.map +1 -1
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/internal/preAuthorized.d.ts +41 -0
- package/_types/tempo/internal/preAuthorized.d.ts.map +1 -0
- package/_types/tempo/internal/relay/feePayer.d.ts.map +1 -1
- package/_types/utils/abi/decodeAbiParameters.d.ts +15 -1
- package/_types/utils/abi/decodeAbiParameters.d.ts.map +1 -1
- package/_types/utils/abi/encodeAbiParameters.d.ts.map +1 -1
- package/_types/utils/ccip.d.ts +4 -3
- package/_types/utils/ccip.d.ts.map +1 -1
- package/_types/utils/encoding/toBytes.d.ts +1 -1
- package/_types/utils/encoding/toBytes.d.ts.map +1 -1
- package/_types/utils/ens/avatar/utils.d.ts +6 -2
- package/_types/utils/ens/avatar/utils.d.ts.map +1 -1
- package/_types/utils/ens/localBatchGatewayRequest.d.ts +6 -1
- package/_types/utils/ens/localBatchGatewayRequest.d.ts.map +1 -1
- package/_types/utils/promise/createBatchScheduler.d.ts.map +1 -1
- package/_types/utils/siwe/validateSiweMessage.d.ts.map +1 -1
- package/_types/zksync/actions/estimateFee.d.ts.map +1 -1
- package/_types/zksync/actions/estimateGasL1ToL2.d.ts.map +1 -1
- package/_types/zksync/actions/finalizeWithdrawal.d.ts.map +1 -1
- package/_types/zksync/actions/sendEip712Transaction.d.ts +1 -1
- package/_types/zksync/actions/sendEip712Transaction.d.ts.map +1 -1
- package/account-abstraction/actions/paymaster/getPaymasterData.ts +23 -16
- package/account-abstraction/actions/paymaster/getPaymasterStubData.ts +27 -16
- package/actions/ens/getEnsAddress.ts +15 -1
- package/actions/index.ts +6 -0
- package/actions/public/call.ts +15 -2
- package/actions/public/getLogs.ts +44 -0
- package/actions/public/internal/isRangeError.ts +18 -0
- package/actions/public/internal/watchTransport.ts +29 -0
- package/actions/public/iterateLogs.ts +209 -0
- package/actions/public/simulateContract.ts +6 -4
- package/actions/public/verifyHash.ts +87 -60
- package/actions/public/waitForTransactionReceipt.ts +31 -1
- package/actions/public/watchBlockHeaders.ts +2 -12
- package/actions/public/watchBlockNumber.ts +6 -24
- package/actions/public/watchBlocks.ts +6 -24
- package/actions/public/watchContractEvent.ts +7 -42
- package/actions/public/watchEvent.ts +7 -42
- package/actions/wallet/prepareTransactionRequest.ts +23 -3
- package/celo/serializers.ts +5 -2
- package/clients/decorators/public.ts +47 -0
- package/constants/contracts.ts +1 -1
- package/errors/chain.ts +2 -2
- package/errors/version.ts +1 -1
- package/index.ts +7 -0
- package/op-stack/actions/buildProveWithdrawal.ts +5 -5
- package/op-stack/actions/getL2Output.ts +24 -11
- package/op-stack/actions/waitToProve.ts +1 -0
- package/package.json +2 -2
- package/tempo/Account.ts +38 -1
- package/tempo/actions/accessKey.ts +1 -1
- package/tempo/actions/accounts.ts +5 -5
- package/tempo/actions/earn/deployment.ts +2 -1
- package/tempo/actions/earn.ts +2 -2
- package/tempo/actions/propAmm.ts +2 -1
- package/tempo/actions/token.ts +10 -2
- package/tempo/chainConfig.ts +20 -0
- package/tempo/internal/preAuthorized.ts +309 -0
- package/tempo/internal/relay/feePayer.ts +33 -11
- package/utils/abi/decodeAbiParameters.ts +60 -9
- package/utils/abi/encodeAbiParameters.ts +6 -4
- package/utils/abi/encodePacked.ts +5 -1
- package/utils/ccip.ts +17 -3
- package/utils/chain/getChainContractAddress.ts +2 -2
- package/utils/encoding/toBytes.ts +4 -6
- package/utils/ens/avatar/utils.ts +38 -4
- package/utils/ens/localBatchGatewayRequest.ts +21 -2
- package/utils/promise/createBatchScheduler.ts +2 -1
- package/utils/siwe/validateSiweMessage.ts +7 -0
- package/zksync/actions/estimateFee.ts +2 -1
- package/zksync/actions/estimateGasL1ToL2.ts +2 -1
- package/zksync/actions/finalizeWithdrawal.ts +4 -3
- package/zksync/actions/sendEip712Transaction.ts +21 -8
- package/zksync/actions/signEip712Transaction.ts +3 -3
|
@@ -354,11 +354,11 @@ export namespace updateConfig {
|
|
|
354
354
|
nextConfig,
|
|
355
355
|
...rest
|
|
356
356
|
} = parameters
|
|
357
|
-
const accountValue = account_
|
|
357
|
+
const accountValue = account_ === undefined ? client.account : account_
|
|
358
358
|
const account = (() => {
|
|
359
359
|
if (
|
|
360
360
|
typeof accountValue === 'object' &&
|
|
361
|
-
accountValue
|
|
361
|
+
accountValue?.source === 'configurable'
|
|
362
362
|
)
|
|
363
363
|
return accountValue as ConfigurableAccount
|
|
364
364
|
return undefined
|
|
@@ -395,7 +395,7 @@ export namespace updateConfig {
|
|
|
395
395
|
})()
|
|
396
396
|
return (await withExecutionError(action)(client, {
|
|
397
397
|
...rest,
|
|
398
|
-
|
|
398
|
+
account: resolvedAccount,
|
|
399
399
|
...updateConfig.call({ currentConfig, nextConfig }),
|
|
400
400
|
} as never)) as never
|
|
401
401
|
}
|
|
@@ -610,8 +610,8 @@ export namespace upgrade {
|
|
|
610
610
|
throw new Error(
|
|
611
611
|
`\`${key}\` is not supported: send \`upgrade.call\` in \`calls\` to batch the upgrade with other calls.`,
|
|
612
612
|
)
|
|
613
|
-
const account = rest.account
|
|
614
|
-
if (typeof account === 'object') {
|
|
613
|
+
const account = rest.account === undefined ? client.account : rest.account
|
|
614
|
+
if (account && typeof account === 'object') {
|
|
615
615
|
if (account.source === 'configurable')
|
|
616
616
|
throw new Error('The account is already a configurable account.')
|
|
617
617
|
if (account.source === 'accessKey')
|
|
@@ -932,7 +932,8 @@ export async function deployErc4626StackSync<
|
|
|
932
932
|
client: Client<Transport, chain, account>,
|
|
933
933
|
parameters: deployErc4626StackSync.Parameters<chain, account>,
|
|
934
934
|
): Promise<deployErc4626StackSync.ReturnValue> {
|
|
935
|
-
const deployer =
|
|
935
|
+
const deployer =
|
|
936
|
+
parameters.account === undefined ? client.account : parameters.account
|
|
936
937
|
if (!deployer) throw new AccountNotFoundError()
|
|
937
938
|
const owner_ = parameters.owner ?? deployer
|
|
938
939
|
const owner = parseAccount(owner_).address
|
package/tempo/actions/earn.ts
CHANGED
|
@@ -3426,8 +3426,8 @@ function resolveRecipient(
|
|
|
3426
3426
|
recipient?: Address | undefined
|
|
3427
3427
|
},
|
|
3428
3428
|
): Address {
|
|
3429
|
-
|
|
3430
|
-
|
|
3429
|
+
const { account = client.account, recipient } = parameters
|
|
3430
|
+
if (recipient) return recipient
|
|
3431
3431
|
if (!account) throw new AccountNotFoundError()
|
|
3432
3432
|
return parseAccount(account).address
|
|
3433
3433
|
}
|
package/tempo/actions/propAmm.ts
CHANGED
|
@@ -816,7 +816,8 @@ export namespace swap {
|
|
|
816
816
|
client: Client<Transport, chain, account>,
|
|
817
817
|
parameters: InputArgs & { account?: Account | Address | null | undefined },
|
|
818
818
|
) {
|
|
819
|
-
const account =
|
|
819
|
+
const account =
|
|
820
|
+
parameters.account === undefined ? client.account : parameters.account
|
|
820
821
|
const recipient =
|
|
821
822
|
parameters.recipient ?? (account && parseAccount(account).address)
|
|
822
823
|
if (!recipient) throw new AccountNotFoundError()
|
package/tempo/actions/token.ts
CHANGED
|
@@ -3482,9 +3482,17 @@ export namespace transfer {
|
|
|
3482
3482
|
client: Client<Transport, chain, account>,
|
|
3483
3483
|
parameters: transfer.Parameters<chain, account>,
|
|
3484
3484
|
): Promise<ReturnType<action>> {
|
|
3485
|
+
const { amount, from, memo, to, token, ...rest } = parameters
|
|
3486
|
+
const call = transfer.call(client, {
|
|
3487
|
+
amount,
|
|
3488
|
+
from,
|
|
3489
|
+
memo,
|
|
3490
|
+
to,
|
|
3491
|
+
token,
|
|
3492
|
+
} as never)
|
|
3485
3493
|
return (await withExecutionError(action)(client, {
|
|
3486
|
-
...
|
|
3487
|
-
...
|
|
3494
|
+
...rest,
|
|
3495
|
+
...call,
|
|
3488
3496
|
} as never)) as never
|
|
3489
3497
|
}
|
|
3490
3498
|
|
package/tempo/chainConfig.ts
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
import * as Formatters from './Formatters.js'
|
|
40
40
|
import type { Hardfork } from './Hardfork.js'
|
|
41
41
|
import * as Concurrent from './internal/concurrent.js'
|
|
42
|
+
import * as PreAuthorized from './internal/preAuthorized.js'
|
|
42
43
|
import { transactionReplacement } from './internal/replacement.js'
|
|
43
44
|
import type * as KeyAuthorizationManager from './KeyAuthorizationManager.js'
|
|
44
45
|
import * as Transaction from './Transaction.js'
|
|
@@ -416,6 +417,25 @@ export const chainConfig = {
|
|
|
416
417
|
if (signature instanceof Uint8Array) return Hex.fromBytes(signature)
|
|
417
418
|
return undefined
|
|
418
419
|
})()
|
|
420
|
+
|
|
421
|
+
// A pre-authorized signature (TIP-1165) carries the root key's authorization of an
|
|
422
|
+
// access key that the chain may not have registered yet.
|
|
423
|
+
if (
|
|
424
|
+
serialized &&
|
|
425
|
+
mode === 'allowAccessKey' &&
|
|
426
|
+
PreAuthorized.isPreAuthorized(serialized)
|
|
427
|
+
)
|
|
428
|
+
return await PreAuthorized.verify(client, {
|
|
429
|
+
account: address,
|
|
430
|
+
blockHash: parameters.blockHash,
|
|
431
|
+
blockNumber: parameters.blockNumber,
|
|
432
|
+
blockTag: parameters.blockTag,
|
|
433
|
+
chainId: (parameters.chain ?? client.chain)?.id,
|
|
434
|
+
hash,
|
|
435
|
+
requireCanonical: parameters.requireCanonical,
|
|
436
|
+
signature: serialized,
|
|
437
|
+
})
|
|
438
|
+
|
|
419
439
|
const envelope = (() => {
|
|
420
440
|
if (!serialized) return
|
|
421
441
|
try {
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import type { Address } from 'abitype'
|
|
2
|
+
import * as Hex from 'ox/Hex'
|
|
3
|
+
import {
|
|
4
|
+
KeyAuthorization,
|
|
5
|
+
SignatureEnvelope,
|
|
6
|
+
SignaturePreAuthorized,
|
|
7
|
+
} from 'ox/tempo'
|
|
8
|
+
import { getBlock } from '../../actions/public/getBlock.js'
|
|
9
|
+
import { getChainId } from '../../actions/public/getChainId.js'
|
|
10
|
+
import { readContract } from '../../actions/public/readContract.js'
|
|
11
|
+
import type { Client } from '../../clients/createClient.js'
|
|
12
|
+
import { zeroAddress } from '../../constants/address.js'
|
|
13
|
+
import { BaseError } from '../../errors/base.js'
|
|
14
|
+
import { ContractFunctionRevertedError } from '../../errors/contract.js'
|
|
15
|
+
import type { BlockTag } from '../../types/block.js'
|
|
16
|
+
import { isAddressEqual } from '../../utils/address/isAddressEqual.js'
|
|
17
|
+
import { getAction } from '../../utils/getAction.js'
|
|
18
|
+
import { keccak256 } from '../../utils/hash/keccak256.js'
|
|
19
|
+
import * as Abis from '../Abis.js'
|
|
20
|
+
import * as Addresses from '../Addresses.js'
|
|
21
|
+
import {
|
|
22
|
+
getMetadata,
|
|
23
|
+
isWitnessBurned,
|
|
24
|
+
verifyHash as verifyAccessKey,
|
|
25
|
+
} from '../actions/accessKey.js'
|
|
26
|
+
import { verifyHash as verifyConfigurableAccount } from '../actions/accounts.js'
|
|
27
|
+
import { isTip20 } from './utils.js'
|
|
28
|
+
|
|
29
|
+
/** Most spending limits the transaction pool accepts in a key authorization. */
|
|
30
|
+
const maxLimits = 256
|
|
31
|
+
/** Most call scope targets, selector rules per target, and recipients per rule the transaction pool accepts. */
|
|
32
|
+
const maxScopes = 64
|
|
33
|
+
/** Transaction gas limit cap (from T1A). */
|
|
34
|
+
const maxTransactionGas = 30_000_000n
|
|
35
|
+
/** Base gas of every transaction. */
|
|
36
|
+
const baseTransactionGas = 21_000n
|
|
37
|
+
/** Gas to create the access key's storage slot. */
|
|
38
|
+
const keySlotGas = 20_000n
|
|
39
|
+
/** Largest spending limit `authorizeKey` accepts. */
|
|
40
|
+
const maxLimit = 2n ** 128n - 1n
|
|
41
|
+
/** TIP-20 selectors a recipient-constrained selector rule may name: `transfer`, `approve`, and `transferWithMemo`. */
|
|
42
|
+
const constrainedSelectors = ['0xa9059cbb', '0x095ea7b3', '0x95777d59']
|
|
43
|
+
|
|
44
|
+
/** Whether a signature ends with the TIP-1165 pre-authorized signature magic suffix. */
|
|
45
|
+
export function isPreAuthorized(signature: Hex.Hex): boolean {
|
|
46
|
+
const size = Hex.size(SignaturePreAuthorized.magicBytes)
|
|
47
|
+
return (
|
|
48
|
+
Hex.size(signature) > size &&
|
|
49
|
+
Hex.slice(signature, -size).toLowerCase() ===
|
|
50
|
+
SignaturePreAuthorized.magicBytes
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Verifies a TIP-1165 pre-authorized signature at a reference block: the access key is
|
|
56
|
+
* registered and passes `verifyKeychain`, or the bundled key authorization would still
|
|
57
|
+
* register it. Every failure, including a decode failure or a reverted read, returns `false`.
|
|
58
|
+
*/
|
|
59
|
+
export async function verify(
|
|
60
|
+
client: Client,
|
|
61
|
+
options: verify.Options,
|
|
62
|
+
): Promise<boolean> {
|
|
63
|
+
const { account, chainId: chainId_, hash, signature, ...block } = options
|
|
64
|
+
|
|
65
|
+
const unwrapped = (() => {
|
|
66
|
+
try {
|
|
67
|
+
return SignaturePreAuthorized.unwrap(signature)
|
|
68
|
+
} catch {
|
|
69
|
+
return undefined
|
|
70
|
+
}
|
|
71
|
+
})()
|
|
72
|
+
if (!unwrapped) return false
|
|
73
|
+
// Only an exact encoding verifies, so no other bytes can carry the same signature.
|
|
74
|
+
if (
|
|
75
|
+
SignaturePreAuthorized.wrap(unwrapped).toLowerCase() !==
|
|
76
|
+
signature.toLowerCase()
|
|
77
|
+
)
|
|
78
|
+
return false
|
|
79
|
+
const { keyAuthorization } = unwrapped
|
|
80
|
+
const keychain = unwrapped.signature
|
|
81
|
+
if (!isAddressEqual(keychain.userAddress, account)) return false
|
|
82
|
+
|
|
83
|
+
// Registered path: an active registered access key verifies without the authorization.
|
|
84
|
+
const registered = await (
|
|
85
|
+
readContract(client, {
|
|
86
|
+
...block,
|
|
87
|
+
...verifyAccessKey.call({
|
|
88
|
+
account,
|
|
89
|
+
admin: false,
|
|
90
|
+
hash,
|
|
91
|
+
signature: SignatureEnvelope.serialize(keychain),
|
|
92
|
+
}),
|
|
93
|
+
} as never) as Promise<boolean>
|
|
94
|
+
).catch(catchRevert)
|
|
95
|
+
if (registered) return true
|
|
96
|
+
|
|
97
|
+
// Access key signature: the inner signature is the authorized key's, over the keychain digest.
|
|
98
|
+
const { inner } = keychain
|
|
99
|
+
const keyId = keyAuthorization.address
|
|
100
|
+
if (inner.type !== keyAuthorization.type) return false
|
|
101
|
+
const signed = (() => {
|
|
102
|
+
try {
|
|
103
|
+
return SignatureEnvelope.verify(inner, {
|
|
104
|
+
address: keyId,
|
|
105
|
+
payload: keccak256(Hex.concat('0x04', hash, account)),
|
|
106
|
+
})
|
|
107
|
+
} catch {
|
|
108
|
+
return false
|
|
109
|
+
}
|
|
110
|
+
})()
|
|
111
|
+
if (!signed) return false
|
|
112
|
+
|
|
113
|
+
if (!isRegistrable(keyAuthorization, account)) return false
|
|
114
|
+
|
|
115
|
+
const root = keyAuthorization.signature
|
|
116
|
+
const digest = KeyAuthorization.getSignPayload(keyAuthorization)
|
|
117
|
+
const read = (call: object) =>
|
|
118
|
+
(
|
|
119
|
+
readContract(client, { ...block, ...call } as never) as Promise<unknown>
|
|
120
|
+
).catch(catchRevert)
|
|
121
|
+
const [chainId, reference, rootValid, rootActive, keyIdActive, key, burned] =
|
|
122
|
+
await Promise.all([
|
|
123
|
+
chainId_ ?? getAction(client, getChainId, 'getChainId')({}),
|
|
124
|
+
getAction(client, getBlock, 'getBlock')(getBlockParameters(block)),
|
|
125
|
+
root.type === 'configurable'
|
|
126
|
+
? read(
|
|
127
|
+
verifyConfigurableAccount.call({
|
|
128
|
+
account,
|
|
129
|
+
hash: digest,
|
|
130
|
+
signature: SignatureEnvelope.serialize(root),
|
|
131
|
+
}),
|
|
132
|
+
)
|
|
133
|
+
: read({
|
|
134
|
+
address: Addresses.signatureVerifier,
|
|
135
|
+
abi: Abis.signatureVerifier,
|
|
136
|
+
functionName: 'verify',
|
|
137
|
+
args: [account, digest, SignatureEnvelope.serialize(root)],
|
|
138
|
+
}),
|
|
139
|
+
// A configuration commitment retires the account's root key.
|
|
140
|
+
root.type === 'configurable'
|
|
141
|
+
? true
|
|
142
|
+
: read({
|
|
143
|
+
address: Addresses.accountKeychain,
|
|
144
|
+
abi: Abis.accountKeychain,
|
|
145
|
+
functionName: 'isAdminKey',
|
|
146
|
+
args: [account, account],
|
|
147
|
+
}),
|
|
148
|
+
// `authorizeKey` refuses a retired root key as an access key.
|
|
149
|
+
read({
|
|
150
|
+
address: Addresses.accountKeychain,
|
|
151
|
+
abi: Abis.accountKeychain,
|
|
152
|
+
functionName: 'isAdminKey',
|
|
153
|
+
args: [keyId, keyId],
|
|
154
|
+
}),
|
|
155
|
+
read(getMetadata.call({ account, accessKey: keyId })) as Promise<
|
|
156
|
+
{ keyId: Address; isRevoked: boolean } | false
|
|
157
|
+
>,
|
|
158
|
+
keyAuthorization.witness
|
|
159
|
+
? read(
|
|
160
|
+
isWitnessBurned.call({
|
|
161
|
+
account,
|
|
162
|
+
witness: keyAuthorization.witness,
|
|
163
|
+
}),
|
|
164
|
+
)
|
|
165
|
+
: false,
|
|
166
|
+
])
|
|
167
|
+
|
|
168
|
+
if (BigInt(chainId) !== keyAuthorization.chainId) return false
|
|
169
|
+
if (
|
|
170
|
+
keyAuthorization.expiry != null &&
|
|
171
|
+
BigInt(keyAuthorization.expiry) <= reference.timestamp
|
|
172
|
+
)
|
|
173
|
+
return false
|
|
174
|
+
if (rootValid !== true || rootActive !== true || keyIdActive !== true)
|
|
175
|
+
return false
|
|
176
|
+
// The access key was never registered and never revoked.
|
|
177
|
+
if (!key || !isAddressEqual(key.keyId, zeroAddress) || key.isRevoked)
|
|
178
|
+
return false
|
|
179
|
+
return burned === false
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export declare namespace verify {
|
|
183
|
+
type Options = {
|
|
184
|
+
/** Account the signature claims to sign for. */
|
|
185
|
+
account: Address
|
|
186
|
+
/** Hash of the reference block. */
|
|
187
|
+
blockHash?: Hex.Hex | undefined
|
|
188
|
+
/** Number of the reference block. */
|
|
189
|
+
blockNumber?: bigint | undefined
|
|
190
|
+
/** Tag of the reference block. */
|
|
191
|
+
blockTag?: BlockTag | undefined
|
|
192
|
+
/** Chain ID the key authorization must name. Read from the node when omitted. */
|
|
193
|
+
chainId?: number | undefined
|
|
194
|
+
/** Signed hash. */
|
|
195
|
+
hash: Hex.Hex
|
|
196
|
+
/** Whether the reference block hash must be canonical. */
|
|
197
|
+
requireCanonical?: boolean | undefined
|
|
198
|
+
/** Pre-authorized signature. */
|
|
199
|
+
signature: Hex.Hex
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Whether a key authorization passes the checks of `authorizeKey` and the transaction pool
|
|
205
|
+
* that need no chain state.
|
|
206
|
+
*
|
|
207
|
+
* @internal
|
|
208
|
+
*/
|
|
209
|
+
export function isRegistrable(
|
|
210
|
+
keyAuthorization: KeyAuthorization.Signed,
|
|
211
|
+
account: Address,
|
|
212
|
+
): boolean {
|
|
213
|
+
const { address, isAdmin, limits, scopes } = keyAuthorization
|
|
214
|
+
if (isAddressEqual(address, zeroAddress)) return false
|
|
215
|
+
if (
|
|
216
|
+
keyAuthorization.account &&
|
|
217
|
+
!isAddressEqual(keyAuthorization.account, account)
|
|
218
|
+
)
|
|
219
|
+
return false
|
|
220
|
+
if (isAdmin) return false
|
|
221
|
+
|
|
222
|
+
if (limits) {
|
|
223
|
+
if (limits.length > maxLimits) return false
|
|
224
|
+
const tokens = new Set(limits.map(({ token }) => token.toLowerCase()))
|
|
225
|
+
if (tokens.size !== limits.length) return false
|
|
226
|
+
if (limits.some(({ limit }) => limit > maxLimit)) return false
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Strict decoding rejects a repeated target, which would not encode back to the same bytes,
|
|
230
|
+
// so grouping the flat scopes by target restores the wire order.
|
|
231
|
+
const targets = new Map<
|
|
232
|
+
string,
|
|
233
|
+
{ selector: Hex.Hex; recipients: readonly Address[] }[]
|
|
234
|
+
>()
|
|
235
|
+
for (const scope of scopes ?? []) {
|
|
236
|
+
const rules = targets.get(scope.address.toLowerCase()) ?? []
|
|
237
|
+
targets.set(scope.address.toLowerCase(), rules)
|
|
238
|
+
if (scope.selector)
|
|
239
|
+
rules.push({
|
|
240
|
+
selector: scope.selector as Hex.Hex,
|
|
241
|
+
recipients: scope.recipients ?? [],
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
if (targets.size > maxScopes) return false
|
|
245
|
+
let selectorCount = 0n
|
|
246
|
+
let recipientCount = 0n
|
|
247
|
+
for (const [target, rules] of targets) {
|
|
248
|
+
if (isAddressEqual(target as Address, zeroAddress)) return false
|
|
249
|
+
if (rules.length > maxScopes) return false
|
|
250
|
+
const selectors = new Set(
|
|
251
|
+
rules.map(({ selector }) => selector.toLowerCase()),
|
|
252
|
+
)
|
|
253
|
+
if (selectors.size !== rules.length) return false
|
|
254
|
+
for (const { selector, recipients } of rules) {
|
|
255
|
+
if (Hex.size(selector) !== 4) return false
|
|
256
|
+
if (recipients.length === 0) continue
|
|
257
|
+
if (recipients.length > maxScopes) return false
|
|
258
|
+
if (!isTip20(target)) return false
|
|
259
|
+
if (!constrainedSelectors.includes(selector.toLowerCase())) return false
|
|
260
|
+
if (
|
|
261
|
+
recipients.some((recipient) => isAddressEqual(recipient, zeroAddress))
|
|
262
|
+
)
|
|
263
|
+
return false
|
|
264
|
+
const unique = new Set(
|
|
265
|
+
recipients.map((recipient) => recipient.toLowerCase()),
|
|
266
|
+
)
|
|
267
|
+
if (unique.size !== recipients.length) return false
|
|
268
|
+
}
|
|
269
|
+
selectorCount += BigInt(rules.length)
|
|
270
|
+
recipientCount += BigInt(
|
|
271
|
+
rules.reduce((count, { recipients }) => count + recipients.length, 0),
|
|
272
|
+
)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// The call scope surcharge alone can exceed the transaction gas limit cap, so no transaction
|
|
276
|
+
// could carry the authorization.
|
|
277
|
+
// Any carrying transaction also pays the base transaction gas and writes the key's slot, so
|
|
278
|
+
// count those as a lower bound on the rest of its intrinsic gas. Account-dependent costs
|
|
279
|
+
// (signature verification, nonce, configurable account) are not counted.
|
|
280
|
+
const surcharge =
|
|
281
|
+
5_000n +
|
|
282
|
+
7_000n * BigInt(targets.size) +
|
|
283
|
+
7_000n * selectorCount +
|
|
284
|
+
5_000n * recipientCount
|
|
285
|
+
return baseTransactionGas + keySlotGas + surcharge <= maxTransactionGas
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** Returns the `getBlock` parameters for a reference block. */
|
|
289
|
+
function getBlockParameters(block: {
|
|
290
|
+
blockHash?: Hex.Hex | undefined
|
|
291
|
+
blockNumber?: bigint | undefined
|
|
292
|
+
blockTag?: BlockTag | undefined
|
|
293
|
+
}) {
|
|
294
|
+
if (block.blockHash) return { blockHash: block.blockHash }
|
|
295
|
+
if (typeof block.blockNumber === 'bigint')
|
|
296
|
+
return { blockNumber: block.blockNumber }
|
|
297
|
+
// An omitted tag keeps the client's default, as the state reads do.
|
|
298
|
+
return block.blockTag ? { blockTag: block.blockTag } : {}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Returns `false` for a reverted read, and rethrows other errors. */
|
|
302
|
+
function catchRevert(error: unknown): false {
|
|
303
|
+
if (
|
|
304
|
+
error instanceof BaseError &&
|
|
305
|
+
error.walk((cause) => cause instanceof ContractFunctionRevertedError)
|
|
306
|
+
)
|
|
307
|
+
return false
|
|
308
|
+
throw error
|
|
309
|
+
}
|
|
@@ -29,7 +29,10 @@ import * as Utils from './utils.js'
|
|
|
29
29
|
|
|
30
30
|
export function create(options: Relay.feePayer.Options): Relay.Plugin {
|
|
31
31
|
// Bind signing permission to the middleware invocation and its validated payload.
|
|
32
|
-
const authorized = new WeakMap<
|
|
32
|
+
const authorized = new WeakMap<
|
|
33
|
+
Relay.Plugin.Context,
|
|
34
|
+
{ payload: Hex.Hex; sender: Address }
|
|
35
|
+
>()
|
|
33
36
|
const allowedFeePayers = new Set(
|
|
34
37
|
options.allowedFeePayers?.map((url) =>
|
|
35
38
|
ExternalFeePayerUrl.normalize(url, {
|
|
@@ -189,11 +192,30 @@ export function create(options: Relay.feePayer.Options): Relay.Plugin {
|
|
|
189
192
|
validity,
|
|
190
193
|
})
|
|
191
194
|
|
|
195
|
+
// One sender is validated, bound, and signed for, so the request, any key authorization account, and the fill must agree.
|
|
196
|
+
const sender = (() => {
|
|
197
|
+
if (external) return undefined
|
|
198
|
+
const senders = [
|
|
199
|
+
parameters.from,
|
|
200
|
+
filled.keyAuthorization?.account,
|
|
201
|
+
filled.from,
|
|
202
|
+
].filter((value): value is Address => typeof value === 'string')
|
|
203
|
+
const [first] = senders
|
|
204
|
+
if (
|
|
205
|
+
first &&
|
|
206
|
+
senders.some((value) => !core_Address.isEqual(value, first))
|
|
207
|
+
)
|
|
208
|
+
throw new RpcResponse.InvalidParamsError({
|
|
209
|
+
message: 'Transaction sender does not match the request.',
|
|
210
|
+
})
|
|
211
|
+
return first
|
|
212
|
+
})()
|
|
213
|
+
|
|
192
214
|
const sponsored =
|
|
193
215
|
external ||
|
|
194
216
|
!options.validate ||
|
|
195
217
|
(await shouldSponsor({
|
|
196
|
-
sender
|
|
218
|
+
sender,
|
|
197
219
|
transaction: filled,
|
|
198
220
|
validate: options.validate,
|
|
199
221
|
}))
|
|
@@ -210,14 +232,14 @@ export function create(options: Relay.feePayer.Options): Relay.Plugin {
|
|
|
210
232
|
|
|
211
233
|
if (options.account && !external && !defer) {
|
|
212
234
|
delete filled.signature
|
|
213
|
-
|
|
214
|
-
authorized.set(
|
|
215
|
-
|
|
216
|
-
TxEnvelopeTempo.getFeePayerSignPayload(
|
|
235
|
+
filled.from = sender!
|
|
236
|
+
authorized.set(context, {
|
|
237
|
+
payload: TxEnvelopeTempo.getFeePayerSignPayload(
|
|
217
238
|
TxEnvelopeTempo.from(filled as never),
|
|
218
239
|
{ sender: filled.from },
|
|
219
240
|
),
|
|
220
|
-
|
|
241
|
+
sender: filled.from,
|
|
242
|
+
})
|
|
221
243
|
}
|
|
222
244
|
return {
|
|
223
245
|
...result,
|
|
@@ -253,16 +275,16 @@ export function create(options: Relay.feePayer.Options): Relay.Plugin {
|
|
|
253
275
|
const transaction = Utils.normalizeTempoTransaction(result.tx)
|
|
254
276
|
const payload = TxEnvelopeTempo.getFeePayerSignPayload(
|
|
255
277
|
TxEnvelopeTempo.from(transaction as never),
|
|
256
|
-
{ sender:
|
|
278
|
+
{ sender: transaction.from ?? approved.sender },
|
|
257
279
|
)
|
|
258
|
-
if (payload !== approved)
|
|
280
|
+
if (payload !== approved.payload)
|
|
259
281
|
throw new RpcResponse.InvalidParamsError({
|
|
260
282
|
message: 'Sponsored transaction changed after validation.',
|
|
261
283
|
})
|
|
262
284
|
const signed = await sign({
|
|
263
285
|
account: options.account,
|
|
264
286
|
onSponsored: options.onSponsored,
|
|
265
|
-
sender:
|
|
287
|
+
sender: approved.sender,
|
|
266
288
|
transaction,
|
|
267
289
|
signal: context.options.signal,
|
|
268
290
|
validity,
|
|
@@ -355,7 +377,7 @@ async function shouldSponsor(options: shouldSponsor.Options) {
|
|
|
355
377
|
|
|
356
378
|
declare namespace shouldSponsor {
|
|
357
379
|
type Options = {
|
|
358
|
-
/** Sender
|
|
380
|
+
/** Sender the request and filled transaction agree on. */
|
|
359
381
|
sender?: Address | undefined
|
|
360
382
|
/** Filled transaction to validate. */
|
|
361
383
|
transaction: Record<string, unknown>
|