viem 2.55.16 → 2.55.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 +16 -0
- package/_cjs/actions/public/fillTransaction.js +45 -35
- package/_cjs/actions/public/fillTransaction.js.map +1 -1
- package/_cjs/actions/wallet/prepareTransactionRequest.js +4 -0
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/chains/definitions/hausTestnet.js +27 -0
- package/_cjs/chains/definitions/hausTestnet.js.map +1 -0
- package/_cjs/chains/index.js +12 -10
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/transaction.js +13 -1
- package/_cjs/errors/transaction.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/abis.js +14 -0
- package/_cjs/op-stack/abis.js.map +1 -1
- package/_cjs/op-stack/actions/estimateOperatorFee.js +26 -15
- package/_cjs/op-stack/actions/estimateOperatorFee.js.map +1 -1
- package/_cjs/tempo/actions/earn.js +12 -4
- package/_cjs/tempo/actions/earn.js.map +1 -1
- package/_cjs/tempo/actions/zone.js +16 -16
- package/_cjs/tempo/actions/zone.js.map +1 -1
- package/_cjs/tempo/zones/Abis.js +2 -2
- package/_cjs/tempo/zones/Abis.js.map +1 -1
- package/_esm/actions/public/fillTransaction.js +49 -36
- package/_esm/actions/public/fillTransaction.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js +4 -0
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/chains/definitions/hausTestnet.js +24 -0
- package/_esm/chains/definitions/hausTestnet.js.map +1 -0
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/transaction.js +11 -0
- package/_esm/errors/transaction.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/abis.js +14 -0
- package/_esm/op-stack/abis.js.map +1 -1
- package/_esm/op-stack/actions/estimateOperatorFee.js +28 -25
- package/_esm/op-stack/actions/estimateOperatorFee.js.map +1 -1
- package/_esm/tempo/actions/earn.js +14 -6
- package/_esm/tempo/actions/earn.js.map +1 -1
- package/_esm/tempo/actions/zone.js +17 -17
- package/_esm/tempo/actions/zone.js.map +1 -1
- package/_esm/tempo/zones/Abis.js +2 -2
- package/_esm/tempo/zones/Abis.js.map +1 -1
- package/_types/actions/public/fillTransaction.d.ts.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/chains/definitions/hausTestnet.d.ts +52 -0
- package/_types/chains/definitions/hausTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/transaction.d.ts +9 -0
- package/_types/errors/transaction.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/op-stack/abis.d.ts +24 -0
- package/_types/op-stack/abis.d.ts.map +1 -1
- package/_types/op-stack/actions/estimateOperatorFee.d.ts +6 -2
- package/_types/op-stack/actions/estimateOperatorFee.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +2 -2
- package/_types/tempo/actions/earn.d.ts +5 -5
- package/_types/tempo/actions/earn.d.ts.map +1 -1
- package/_types/tempo/actions/zone.d.ts +17 -17
- package/_types/tempo/actions/zone.d.ts.map +1 -1
- package/_types/tempo/zones/Abis.d.ts +2 -2
- package/actions/public/fillTransaction.ts +53 -35
- package/actions/wallet/prepareTransactionRequest.ts +6 -0
- package/chains/definitions/hausTestnet.ts +24 -0
- package/chains/index.ts +1 -0
- package/errors/transaction.ts +21 -0
- package/errors/version.ts +1 -1
- package/index.ts +2 -0
- package/op-stack/abis.ts +14 -0
- package/op-stack/actions/estimateOperatorFee.ts +50 -36
- package/package.json +1 -1
- package/tempo/Decorator.ts +2 -2
- package/tempo/actions/earn.ts +19 -11
- package/tempo/actions/zone.ts +35 -31
- package/tempo/zones/Abis.ts +2 -2
package/op-stack/abis.ts
CHANGED
|
@@ -46,6 +46,20 @@ export const gasPriceOracleAbi = [
|
|
|
46
46
|
stateMutability: 'view',
|
|
47
47
|
type: 'function',
|
|
48
48
|
},
|
|
49
|
+
{
|
|
50
|
+
inputs: [{ internalType: 'uint256', name: '_gasUsed', type: 'uint256' }],
|
|
51
|
+
name: 'getOperatorFee',
|
|
52
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
53
|
+
stateMutability: 'view',
|
|
54
|
+
type: 'function',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
inputs: [],
|
|
58
|
+
name: 'isJovian',
|
|
59
|
+
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
|
|
60
|
+
stateMutability: 'view',
|
|
61
|
+
type: 'function',
|
|
62
|
+
},
|
|
49
63
|
{
|
|
50
64
|
inputs: [],
|
|
51
65
|
name: 'l1BaseFee',
|
|
@@ -18,7 +18,7 @@ import type { TransactionRequestEIP1559 } from '../../types/transaction.js'
|
|
|
18
18
|
import type { RequestErrorType } from '../../utils/buildRequest.js'
|
|
19
19
|
import { getChainContractAddress } from '../../utils/chain/getChainContractAddress.js'
|
|
20
20
|
import type { HexToNumberErrorType } from '../../utils/encoding/fromHex.js'
|
|
21
|
-
import { l1BlockAbi } from '../abis.js'
|
|
21
|
+
import { gasPriceOracleAbi, l1BlockAbi } from '../abis.js'
|
|
22
22
|
import { contracts } from '../contracts.js'
|
|
23
23
|
|
|
24
24
|
export type EstimateOperatorFeeParameters<
|
|
@@ -28,7 +28,12 @@ export type EstimateOperatorFeeParameters<
|
|
|
28
28
|
> = Omit<TransactionRequestEIP1559, 'from'> &
|
|
29
29
|
GetAccountParameter<TAccount> &
|
|
30
30
|
GetChainParameter<TChain, TChainOverride> & {
|
|
31
|
-
/**
|
|
31
|
+
/** Gas price oracle address. */
|
|
32
|
+
gasPriceOracleAddress?: Address | undefined
|
|
33
|
+
/**
|
|
34
|
+
* L1 block attributes contract address.
|
|
35
|
+
* @deprecated Use `gasPriceOracleAddress` instead.
|
|
36
|
+
*/
|
|
32
37
|
l1BlockAddress?: Address | undefined
|
|
33
38
|
}
|
|
34
39
|
|
|
@@ -46,7 +51,6 @@ export type EstimateOperatorFeeErrorType =
|
|
|
46
51
|
*
|
|
47
52
|
* Operator fees are part of the Isthmus upgrade and allow OP Stack operators
|
|
48
53
|
* to recover costs related to Alt-DA, ZK proving, or custom gas tokens.
|
|
49
|
-
* Returns 0 for pre-Isthmus chains or when operator fee functions don't exist.
|
|
50
54
|
*
|
|
51
55
|
* @param client - Client to use
|
|
52
56
|
* @param parameters - {@link EstimateOperatorFeeParameters}
|
|
@@ -75,45 +79,55 @@ export async function estimateOperatorFee<
|
|
|
75
79
|
client: Client<Transport, TChain, TAccount>,
|
|
76
80
|
args: EstimateOperatorFeeParameters<TChain, TAccount, TChainOverride>,
|
|
77
81
|
): Promise<EstimateOperatorFeeReturnType> {
|
|
78
|
-
const {
|
|
82
|
+
const {
|
|
83
|
+
chain = client.chain,
|
|
84
|
+
gasPriceOracleAddress: gasPriceOracleAddress_,
|
|
85
|
+
l1BlockAddress,
|
|
86
|
+
} = args
|
|
79
87
|
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
if (chain
|
|
88
|
+
const gasPriceOracleAddress = (() => {
|
|
89
|
+
if (gasPriceOracleAddress_) return gasPriceOracleAddress_
|
|
90
|
+
if (chain)
|
|
83
91
|
return getChainContractAddress({
|
|
84
92
|
chain,
|
|
85
|
-
contract: '
|
|
93
|
+
contract: 'gasPriceOracle',
|
|
86
94
|
})
|
|
87
|
-
return contracts.
|
|
88
|
-
})()
|
|
95
|
+
return contracts.gasPriceOracle.address
|
|
96
|
+
})() as Address
|
|
89
97
|
|
|
90
|
-
|
|
91
|
-
// it means this is a pre-Isthmus chain and operator fees don't apply
|
|
92
|
-
try {
|
|
93
|
-
// Get operator fee parameters first to fail fast if not supported
|
|
94
|
-
const [operatorFeeScalar, operatorFeeConstant] = await Promise.all([
|
|
95
|
-
readContract(client, {
|
|
96
|
-
abi: l1BlockAbi,
|
|
97
|
-
address: l1BlockAddress,
|
|
98
|
-
functionName: 'operatorFeeScalar',
|
|
99
|
-
}),
|
|
100
|
-
readContract(client, {
|
|
101
|
-
abi: l1BlockAbi,
|
|
102
|
-
address: l1BlockAddress,
|
|
103
|
-
functionName: 'operatorFeeConstant',
|
|
104
|
-
}),
|
|
105
|
-
])
|
|
98
|
+
const gasUsed = await estimateGas(client, args as EstimateGasParameters)
|
|
106
99
|
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
if (l1BlockAddress) {
|
|
101
|
+
// `isJovian` is unavailable on Isthmus Gas Price Oracle implementations.
|
|
102
|
+
const [operatorFeeScalar, operatorFeeConstant, isJovian] =
|
|
103
|
+
await Promise.all([
|
|
104
|
+
readContract(client, {
|
|
105
|
+
abi: l1BlockAbi,
|
|
106
|
+
address: l1BlockAddress,
|
|
107
|
+
functionName: 'operatorFeeScalar',
|
|
108
|
+
}),
|
|
109
|
+
readContract(client, {
|
|
110
|
+
abi: l1BlockAbi,
|
|
111
|
+
address: l1BlockAddress,
|
|
112
|
+
functionName: 'operatorFeeConstant',
|
|
113
|
+
}),
|
|
114
|
+
readContract(client, {
|
|
115
|
+
abi: gasPriceOracleAbi,
|
|
116
|
+
address: gasPriceOracleAddress,
|
|
117
|
+
functionName: 'isJovian',
|
|
118
|
+
}).catch(() => false),
|
|
119
|
+
])
|
|
109
120
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return
|
|
114
|
-
} catch {
|
|
115
|
-
// If any call fails, this is likely a pre-Isthmus chain or the contract
|
|
116
|
-
// doesn't support these functions. Return 0 for operator fee.
|
|
117
|
-
return 0n
|
|
121
|
+
const scalar = BigInt(operatorFeeScalar)
|
|
122
|
+
const constant = BigInt(operatorFeeConstant)
|
|
123
|
+
if (isJovian) return gasUsed * scalar * 100n + constant
|
|
124
|
+
return (gasUsed * scalar) / 1_000_000n + constant
|
|
118
125
|
}
|
|
126
|
+
|
|
127
|
+
return readContract(client, {
|
|
128
|
+
abi: gasPriceOracleAbi,
|
|
129
|
+
address: gasPriceOracleAddress,
|
|
130
|
+
functionName: 'getOperatorFee',
|
|
131
|
+
args: [gasUsed],
|
|
132
|
+
})
|
|
119
133
|
}
|
package/package.json
CHANGED
package/tempo/Decorator.ts
CHANGED
|
@@ -1926,8 +1926,8 @@ type DecoratorBase<
|
|
|
1926
1926
|
* assetToken: '0x...',
|
|
1927
1927
|
* gateway: '0x...',
|
|
1928
1928
|
* recipient: '0x...',
|
|
1929
|
-
* recoveryRecipient: '0x...',
|
|
1930
1929
|
* shareAmountMin: 99_500_000n,
|
|
1930
|
+
* tempoRefundRecipient: '0x...',
|
|
1931
1931
|
* vault: '0x...',
|
|
1932
1932
|
* vaultAssetAmountMin: 99_000_000n,
|
|
1933
1933
|
* zoneId: 7,
|
|
@@ -2157,9 +2157,9 @@ type DecoratorBase<
|
|
|
2157
2157
|
* const prepared = await parentClient.earn.privateRedeem.prepare({
|
|
2158
2158
|
* gateway: '0x...',
|
|
2159
2159
|
* recipient: '0x...',
|
|
2160
|
-
* recoveryRecipient: '0x...',
|
|
2161
2160
|
* shareAmount: 100_000_000n,
|
|
2162
2161
|
* slippageBps: 50,
|
|
2162
|
+
* tempoRefundRecipient: '0x...',
|
|
2163
2163
|
* vault: '0x...',
|
|
2164
2164
|
* zoneId: 7,
|
|
2165
2165
|
* })
|
package/tempo/actions/earn.ts
CHANGED
|
@@ -968,8 +968,8 @@ export namespace depositSharesSync {
|
|
|
968
968
|
* assetToken: '0x...',
|
|
969
969
|
* gateway: '0x...',
|
|
970
970
|
* recipient: '0x...',
|
|
971
|
-
* recoveryRecipient: '0x...',
|
|
972
971
|
* shareAmountMin: 99_500_000n,
|
|
972
|
+
* tempoRefundRecipient: '0x...',
|
|
973
973
|
* vault: '0x...',
|
|
974
974
|
* vaultAssetAmountMin: 99_000_000n,
|
|
975
975
|
* zoneId: 7,
|
|
@@ -1019,11 +1019,11 @@ export namespace privateDeposit {
|
|
|
1019
1019
|
actionId = Hex.random(32),
|
|
1020
1020
|
assetAmount,
|
|
1021
1021
|
callbackGas = zoneGatewayCallbackGas,
|
|
1022
|
-
|
|
1022
|
+
tempoRefundRecipient,
|
|
1023
|
+
fallbackRecipient = tempoRefundRecipient,
|
|
1023
1024
|
gateway,
|
|
1024
1025
|
portalAddress: portalAddress_,
|
|
1025
1026
|
recipient,
|
|
1026
|
-
recoveryRecipient,
|
|
1027
1027
|
returnMemo,
|
|
1028
1028
|
vault,
|
|
1029
1029
|
withdrawalMemo,
|
|
@@ -1062,7 +1062,11 @@ export namespace privateDeposit {
|
|
|
1062
1062
|
minEarnShares: shareAmountMin,
|
|
1063
1063
|
minOutputAmount: 0n,
|
|
1064
1064
|
minVaultAssets: parameters.vaultAssetAmountMin ?? assetAmount,
|
|
1065
|
-
zoneReturn: {
|
|
1065
|
+
zoneReturn: {
|
|
1066
|
+
encrypted,
|
|
1067
|
+
keyIndex,
|
|
1068
|
+
refundRecipient: tempoRefundRecipient,
|
|
1069
|
+
},
|
|
1066
1070
|
},
|
|
1067
1071
|
])
|
|
1068
1072
|
return {
|
|
@@ -2346,9 +2350,9 @@ export namespace redeemSync {
|
|
|
2346
2350
|
* const prepared = await Actions.earn.privateRedeem.prepare(parentClient, {
|
|
2347
2351
|
* gateway: '0x...',
|
|
2348
2352
|
* recipient: '0x...',
|
|
2349
|
-
* recoveryRecipient: '0x...',
|
|
2350
2353
|
* shareAmount: 100_000_000n,
|
|
2351
2354
|
* slippageBps: 50,
|
|
2355
|
+
* tempoRefundRecipient: '0x...',
|
|
2352
2356
|
* vault: '0x...',
|
|
2353
2357
|
* zoneId: 7,
|
|
2354
2358
|
* })
|
|
@@ -2396,11 +2400,11 @@ export namespace privateRedeem {
|
|
|
2396
2400
|
const {
|
|
2397
2401
|
actionId = Hex.random(32),
|
|
2398
2402
|
callbackGas = zoneGatewayCallbackGas,
|
|
2399
|
-
|
|
2403
|
+
tempoRefundRecipient,
|
|
2404
|
+
fallbackRecipient = tempoRefundRecipient,
|
|
2400
2405
|
gateway,
|
|
2401
2406
|
portalAddress: portalAddress_,
|
|
2402
2407
|
recipient,
|
|
2403
|
-
recoveryRecipient,
|
|
2404
2408
|
returnMemo,
|
|
2405
2409
|
shareAmount,
|
|
2406
2410
|
vault,
|
|
@@ -2456,7 +2460,11 @@ export namespace privateRedeem {
|
|
|
2456
2460
|
minEarnShares: 0n,
|
|
2457
2461
|
minOutputAmount: assetAmountMin,
|
|
2458
2462
|
minVaultAssets: assetAmountMin,
|
|
2459
|
-
zoneReturn: {
|
|
2463
|
+
zoneReturn: {
|
|
2464
|
+
encrypted,
|
|
2465
|
+
keyIndex,
|
|
2466
|
+
refundRecipient: tempoRefundRecipient,
|
|
2467
|
+
},
|
|
2460
2468
|
},
|
|
2461
2469
|
])
|
|
2462
2470
|
return {
|
|
@@ -3016,7 +3024,7 @@ type PrivatePreparationParameters = {
|
|
|
3016
3024
|
actionId?: Hex.Hex | undefined
|
|
3017
3025
|
/** Gas reserved for the parent-chain callback. @default `10_000_000n` */
|
|
3018
3026
|
callbackGas?: bigint | undefined
|
|
3019
|
-
/** Public recipient if the parent-chain callback fails. @default `
|
|
3027
|
+
/** Public recipient if the parent-chain callback fails. @default `tempoRefundRecipient` */
|
|
3020
3028
|
fallbackRecipient?: Address | undefined
|
|
3021
3029
|
/** Zone gateway address. */
|
|
3022
3030
|
gateway: Address
|
|
@@ -3024,10 +3032,10 @@ type PrivatePreparationParameters = {
|
|
|
3024
3032
|
portalAddress?: Address | undefined
|
|
3025
3033
|
/** Encrypted recipient for the returned tokens. */
|
|
3026
3034
|
recipient: Address
|
|
3027
|
-
/** Public recipient if the encrypted return fails. */
|
|
3028
|
-
recoveryRecipient: Address
|
|
3029
3035
|
/** Optional memo encrypted with the returned Zone deposit. */
|
|
3030
3036
|
returnMemo?: Hex.Hex | undefined
|
|
3037
|
+
/** Refund recipient on the parent chain if the return deposit bounces. */
|
|
3038
|
+
tempoRefundRecipient: Address
|
|
3031
3039
|
/** Vault address. */
|
|
3032
3040
|
vault: Address
|
|
3033
3041
|
/** Optional memo attached to the Zone withdrawal. */
|
package/tempo/actions/zone.ts
CHANGED
|
@@ -76,8 +76,6 @@ export type EncryptedPayload = {
|
|
|
76
76
|
export type PreparedEncryptedDeposit = {
|
|
77
77
|
/** Amount of tokens to deposit. */
|
|
78
78
|
amount: bigint
|
|
79
|
-
/** Refund recipient on the parent chain if the deposit bounces. */
|
|
80
|
-
bouncebackRecipient: Address
|
|
81
79
|
/** Parent chain ID (e.g. `42431` for moderato). */
|
|
82
80
|
chainId: number
|
|
83
81
|
/** Encrypted deposit payload. */
|
|
@@ -88,6 +86,8 @@ export type PreparedEncryptedDeposit = {
|
|
|
88
86
|
portalAddress: Address
|
|
89
87
|
/** Address that will call the Zone portal. */
|
|
90
88
|
sender: Address
|
|
89
|
+
/** Refund recipient on the parent chain if the deposit bounces. */
|
|
90
|
+
tempoRefundRecipient: Address
|
|
91
91
|
/** Token address or ID to deposit. */
|
|
92
92
|
token: TokenId.TokenIdOrAddress
|
|
93
93
|
/** Zone ID (e.g. `7`). */
|
|
@@ -153,12 +153,13 @@ export async function deposit<
|
|
|
153
153
|
if (!account_) throw new Error('`account` is required.')
|
|
154
154
|
|
|
155
155
|
const recipient = parameters.recipient ?? account_.address
|
|
156
|
-
const
|
|
156
|
+
const tempoRefundRecipient =
|
|
157
|
+
parameters.tempoRefundRecipient ?? account_.address
|
|
157
158
|
const args = {
|
|
158
159
|
...parameters,
|
|
159
|
-
bouncebackRecipient,
|
|
160
160
|
chainId,
|
|
161
161
|
recipient,
|
|
162
|
+
tempoRefundRecipient,
|
|
162
163
|
}
|
|
163
164
|
return sendTransaction(client, {
|
|
164
165
|
...rest,
|
|
@@ -172,18 +173,16 @@ export namespace deposit {
|
|
|
172
173
|
chain extends Chain | undefined = Chain | undefined,
|
|
173
174
|
account extends Account | undefined = Account | undefined,
|
|
174
175
|
> = WriteParameters<chain, account> &
|
|
175
|
-
Omit<Args, '
|
|
176
|
-
/** Refund recipient on the parent chain. @default `account.address` */
|
|
177
|
-
bouncebackRecipient?: Address | undefined
|
|
176
|
+
Omit<Args, 'chainId' | 'recipient' | 'tempoRefundRecipient'> & {
|
|
178
177
|
/** Recipient address in the zone. @default `account.address` */
|
|
179
178
|
recipient?: Address | undefined
|
|
179
|
+
/** Refund recipient on the parent chain. @default `account.address` */
|
|
180
|
+
tempoRefundRecipient?: Address | undefined
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
export type Args = {
|
|
183
184
|
/** Amount of tokens to deposit. */
|
|
184
185
|
amount: bigint
|
|
185
|
-
/** Refund recipient on the parent chain if the deposit bounces. */
|
|
186
|
-
bouncebackRecipient: Address
|
|
187
186
|
/** Parent chain ID (e.g. `42431` for moderato). */
|
|
188
187
|
chainId: number
|
|
189
188
|
/** Optional deposit memo. @default `0x00...00` */
|
|
@@ -192,6 +191,8 @@ export namespace deposit {
|
|
|
192
191
|
portalAddress?: Address | undefined
|
|
193
192
|
/** Recipient address in the zone. */
|
|
194
193
|
recipient: Address
|
|
194
|
+
/** Refund recipient on the parent chain if the deposit bounces. */
|
|
195
|
+
tempoRefundRecipient: Address
|
|
195
196
|
/** Token address or ID to deposit. */
|
|
196
197
|
token: TokenId.TokenIdOrAddress
|
|
197
198
|
/** Zone ID (e.g. `7`). */
|
|
@@ -212,10 +213,10 @@ export namespace deposit {
|
|
|
212
213
|
export function calls(args: Args) {
|
|
213
214
|
const {
|
|
214
215
|
amount,
|
|
215
|
-
bouncebackRecipient,
|
|
216
216
|
chainId,
|
|
217
217
|
memo = zeroHash,
|
|
218
218
|
recipient,
|
|
219
|
+
tempoRefundRecipient,
|
|
219
220
|
token,
|
|
220
221
|
zoneId,
|
|
221
222
|
} = args
|
|
@@ -232,7 +233,7 @@ export namespace deposit {
|
|
|
232
233
|
address: portalAddress,
|
|
233
234
|
abi: ZoneAbis.zonePortal,
|
|
234
235
|
functionName: 'deposit',
|
|
235
|
-
args: [tokenAddress, recipient, amount, memo,
|
|
236
|
+
args: [tokenAddress, recipient, amount, memo, tempoRefundRecipient],
|
|
236
237
|
})
|
|
237
238
|
return [approveCall, depositCall]
|
|
238
239
|
}
|
|
@@ -286,12 +287,13 @@ export async function depositSync<
|
|
|
286
287
|
if (!account_) throw new Error('`account` is required.')
|
|
287
288
|
|
|
288
289
|
const recipient = parameters.recipient ?? account_.address
|
|
289
|
-
const
|
|
290
|
+
const tempoRefundRecipient =
|
|
291
|
+
parameters.tempoRefundRecipient ?? account_.address
|
|
290
292
|
const args = {
|
|
291
293
|
...parameters,
|
|
292
|
-
bouncebackRecipient,
|
|
293
294
|
chainId,
|
|
294
295
|
recipient,
|
|
296
|
+
tempoRefundRecipient,
|
|
295
297
|
}
|
|
296
298
|
const receipt = await sendTransactionSync(client, {
|
|
297
299
|
...rest,
|
|
@@ -478,7 +480,8 @@ export async function encryptedDeposit<
|
|
|
478
480
|
const account_ = account ? parseAccount(account) : undefined
|
|
479
481
|
if (!account_) throw new Error('`account` is required.')
|
|
480
482
|
|
|
481
|
-
const
|
|
483
|
+
const tempoRefundRecipient =
|
|
484
|
+
parameters.tempoRefundRecipient ?? account_.address
|
|
482
485
|
|
|
483
486
|
if ('encrypted' in parameters) {
|
|
484
487
|
if (parameters.chainId !== chainId) {
|
|
@@ -490,7 +493,7 @@ export async function encryptedDeposit<
|
|
|
490
493
|
...pickWriteParameters(parameters as never),
|
|
491
494
|
calls: encryptedDeposit.calls({
|
|
492
495
|
...parameters,
|
|
493
|
-
|
|
496
|
+
tempoRefundRecipient,
|
|
494
497
|
}),
|
|
495
498
|
} as never) as never
|
|
496
499
|
}
|
|
@@ -499,11 +502,11 @@ export async function encryptedDeposit<
|
|
|
499
502
|
|
|
500
503
|
const prepared = await encryptedDeposit.prepare(client, {
|
|
501
504
|
amount: parameters.amount,
|
|
502
|
-
bouncebackRecipient,
|
|
503
505
|
memo: parameters.memo,
|
|
504
506
|
portalAddress: parameters.portalAddress,
|
|
505
507
|
recipient,
|
|
506
508
|
sender: account_.address,
|
|
509
|
+
tempoRefundRecipient,
|
|
507
510
|
token: parameters.token,
|
|
508
511
|
zoneId: parameters.zoneId,
|
|
509
512
|
})
|
|
@@ -522,16 +525,16 @@ export namespace encryptedDeposit {
|
|
|
522
525
|
(
|
|
523
526
|
| (Omit<
|
|
524
527
|
Args,
|
|
525
|
-
| 'bouncebackRecipient'
|
|
526
528
|
| 'chainId'
|
|
527
529
|
| 'encrypted'
|
|
528
530
|
| 'keyIndex'
|
|
529
531
|
| 'recipient'
|
|
532
|
+
| 'tempoRefundRecipient'
|
|
530
533
|
> & {
|
|
531
|
-
/** Refund recipient on the parent chain. @default `account.address` */
|
|
532
|
-
bouncebackRecipient?: Address | undefined
|
|
533
534
|
/** Recipient address in the zone. @default `account.address` */
|
|
534
535
|
recipient?: Address | undefined
|
|
536
|
+
/** Refund recipient on the parent chain. @default `account.address` */
|
|
537
|
+
tempoRefundRecipient?: Address | undefined
|
|
535
538
|
})
|
|
536
539
|
| PreparedEncryptedDeposit
|
|
537
540
|
)
|
|
@@ -539,8 +542,6 @@ export namespace encryptedDeposit {
|
|
|
539
542
|
export type Args = {
|
|
540
543
|
/** Amount of tokens to deposit. */
|
|
541
544
|
amount: bigint
|
|
542
|
-
/** Refund recipient on the parent chain if the deposit bounces. */
|
|
543
|
-
bouncebackRecipient: Address
|
|
544
545
|
/** Parent chain ID (e.g. `42431` for moderato). */
|
|
545
546
|
chainId: number
|
|
546
547
|
/** Encrypted deposit payload. */
|
|
@@ -553,6 +554,8 @@ export namespace encryptedDeposit {
|
|
|
553
554
|
portalAddress?: Address | undefined
|
|
554
555
|
/** Recipient address in the zone. */
|
|
555
556
|
recipient: Address
|
|
557
|
+
/** Refund recipient on the parent chain if the deposit bounces. */
|
|
558
|
+
tempoRefundRecipient: Address
|
|
556
559
|
/** Token address or ID to deposit. */
|
|
557
560
|
token: TokenId.TokenIdOrAddress
|
|
558
561
|
/** Zone ID (e.g. `7`). */
|
|
@@ -581,9 +584,9 @@ export namespace encryptedDeposit {
|
|
|
581
584
|
* const prepared = await Actions.zone.encryptedDeposit.prepare(client, {
|
|
582
585
|
* token: '0x20c0...0001',
|
|
583
586
|
* amount: 1_000_000n,
|
|
584
|
-
* bouncebackRecipient: '0x...',
|
|
585
587
|
* recipient: '0x...',
|
|
586
588
|
* sender: '0x...',
|
|
589
|
+
* tempoRefundRecipient: '0x...',
|
|
587
590
|
* zoneId: 7,
|
|
588
591
|
* })
|
|
589
592
|
* ```
|
|
@@ -604,11 +607,11 @@ export namespace encryptedDeposit {
|
|
|
604
607
|
|
|
605
608
|
const {
|
|
606
609
|
amount,
|
|
607
|
-
bouncebackRecipient,
|
|
608
610
|
memo,
|
|
609
611
|
portalAddress: portalAddress_,
|
|
610
612
|
recipient,
|
|
611
613
|
sender: sender_ = client.account?.address,
|
|
614
|
+
tempoRefundRecipient,
|
|
612
615
|
token,
|
|
613
616
|
zoneId,
|
|
614
617
|
...rest
|
|
@@ -634,12 +637,12 @@ export namespace encryptedDeposit {
|
|
|
634
637
|
|
|
635
638
|
return {
|
|
636
639
|
amount,
|
|
637
|
-
bouncebackRecipient,
|
|
638
640
|
chainId,
|
|
639
641
|
encrypted,
|
|
640
642
|
keyIndex,
|
|
641
643
|
portalAddress,
|
|
642
644
|
sender,
|
|
645
|
+
tempoRefundRecipient,
|
|
643
646
|
token,
|
|
644
647
|
zoneId,
|
|
645
648
|
}
|
|
@@ -661,8 +664,6 @@ export namespace encryptedDeposit {
|
|
|
661
664
|
export type Args = {
|
|
662
665
|
/** Amount of tokens to deposit. */
|
|
663
666
|
amount: bigint
|
|
664
|
-
/** Refund recipient on the parent chain if the deposit bounces. */
|
|
665
|
-
bouncebackRecipient: Address
|
|
666
667
|
/** Optional deposit memo. @default `0x00...00` */
|
|
667
668
|
memo?: Hex.Hex | undefined
|
|
668
669
|
/** Zone portal address. @default resolved via the portal registry. */
|
|
@@ -671,6 +672,8 @@ export namespace encryptedDeposit {
|
|
|
671
672
|
recipient: Address
|
|
672
673
|
/** Address that will call the Zone portal. */
|
|
673
674
|
sender: Address
|
|
675
|
+
/** Refund recipient on the parent chain if the deposit bounces. */
|
|
676
|
+
tempoRefundRecipient: Address
|
|
674
677
|
/** Token address or ID to deposit. */
|
|
675
678
|
token: TokenId.TokenIdOrAddress
|
|
676
679
|
/** Zone ID (e.g. `7`). */
|
|
@@ -796,10 +799,10 @@ export namespace encryptedDeposit {
|
|
|
796
799
|
export function calls(args: Args | PreparedEncryptedDeposit) {
|
|
797
800
|
const {
|
|
798
801
|
amount,
|
|
799
|
-
bouncebackRecipient,
|
|
800
802
|
chainId,
|
|
801
803
|
encrypted,
|
|
802
804
|
keyIndex,
|
|
805
|
+
tempoRefundRecipient,
|
|
803
806
|
token,
|
|
804
807
|
zoneId,
|
|
805
808
|
} = args
|
|
@@ -828,7 +831,7 @@ export namespace encryptedDeposit {
|
|
|
828
831
|
amount,
|
|
829
832
|
keyIndex,
|
|
830
833
|
encryptedPayload,
|
|
831
|
-
|
|
834
|
+
tempoRefundRecipient,
|
|
832
835
|
],
|
|
833
836
|
})
|
|
834
837
|
return [approveCall, depositCall]
|
|
@@ -882,7 +885,8 @@ export async function encryptedDepositSync<
|
|
|
882
885
|
const account_ = account ? parseAccount(account) : undefined
|
|
883
886
|
if (!account_) throw new Error('`account` is required.')
|
|
884
887
|
|
|
885
|
-
const
|
|
888
|
+
const tempoRefundRecipient =
|
|
889
|
+
parameters.tempoRefundRecipient ?? account_.address
|
|
886
890
|
|
|
887
891
|
if ('encrypted' in parameters) {
|
|
888
892
|
if (parameters.chainId !== chainId) {
|
|
@@ -896,7 +900,7 @@ export async function encryptedDepositSync<
|
|
|
896
900
|
throwOnReceiptRevert,
|
|
897
901
|
calls: encryptedDeposit.calls({
|
|
898
902
|
...parameters,
|
|
899
|
-
|
|
903
|
+
tempoRefundRecipient,
|
|
900
904
|
}),
|
|
901
905
|
} as never)
|
|
902
906
|
return { receipt }
|
|
@@ -906,11 +910,11 @@ export async function encryptedDepositSync<
|
|
|
906
910
|
|
|
907
911
|
const prepared = await encryptedDeposit.prepare(client, {
|
|
908
912
|
amount: parameters.amount,
|
|
909
|
-
bouncebackRecipient,
|
|
910
913
|
memo: parameters.memo,
|
|
911
914
|
portalAddress: parameters.portalAddress,
|
|
912
915
|
recipient,
|
|
913
916
|
sender: account_.address,
|
|
917
|
+
tempoRefundRecipient,
|
|
914
918
|
token: parameters.token,
|
|
915
919
|
zoneId: parameters.zoneId,
|
|
916
920
|
})
|
package/tempo/zones/Abis.ts
CHANGED
|
@@ -121,7 +121,7 @@ export const zonePortal = [
|
|
|
121
121
|
{ name: 'to', type: 'address' },
|
|
122
122
|
{ name: 'amount', type: 'uint128' },
|
|
123
123
|
{ name: 'memo', type: 'bytes32' },
|
|
124
|
-
{ name: '
|
|
124
|
+
{ name: 'tempoRefundRecipient', type: 'address' },
|
|
125
125
|
],
|
|
126
126
|
outputs: [{ name: '', type: 'bytes32' }],
|
|
127
127
|
},
|
|
@@ -144,7 +144,7 @@ export const zonePortal = [
|
|
|
144
144
|
{ name: 'tag', type: 'bytes16' },
|
|
145
145
|
],
|
|
146
146
|
},
|
|
147
|
-
{ name: '
|
|
147
|
+
{ name: 'tempoRefundRecipient', type: 'address' },
|
|
148
148
|
],
|
|
149
149
|
outputs: [{ name: '', type: 'bytes32' }],
|
|
150
150
|
},
|