viem 2.51.3 → 2.52.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/CHANGELOG.md +32 -0
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/chains/definitions/citrate.js +17 -0
- package/_cjs/chains/definitions/citrate.js.map +1 -0
- package/_cjs/chains/definitions/grav.js +24 -0
- package/_cjs/chains/definitions/grav.js.map +1 -0
- package/_cjs/chains/definitions/ladyChain.js +22 -0
- package/_cjs/chains/definitions/ladyChain.js.map +1 -0
- package/_cjs/chains/definitions/tempoModerato.js +1 -0
- package/_cjs/chains/definitions/tempoModerato.js.map +1 -1
- package/_cjs/chains/definitions/valygoNft.js +37 -0
- package/_cjs/chains/definitions/valygoNft.js.map +1 -0
- package/_cjs/chains/definitions/valygoSmartchain.js +37 -0
- package/_cjs/chains/definitions/valygoSmartchain.js.map +1 -0
- package/_cjs/chains/index.js +23 -13
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/tempo/Abis.js +189 -1
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Account.js +62 -23
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/Addresses.js +3 -1
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Decorator.js +23 -0
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/Formatters.js +2 -1
- package/_cjs/tempo/Formatters.js.map +1 -1
- package/_cjs/tempo/Hardfork.js +3 -0
- package/_cjs/tempo/Hardfork.js.map +1 -1
- package/_cjs/tempo/Transaction.js +22 -0
- package/_cjs/tempo/Transaction.js.map +1 -1
- package/_cjs/tempo/actions/accessKey.js +238 -72
- package/_cjs/tempo/actions/accessKey.js.map +1 -1
- package/_cjs/tempo/actions/index.js +2 -1
- package/_cjs/tempo/actions/index.js.map +1 -1
- package/_cjs/tempo/actions/receivePolicy.js +363 -0
- package/_cjs/tempo/actions/receivePolicy.js.map +1 -0
- package/_cjs/tempo/chainConfig.js +10 -0
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/index.js +3 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/chains/definitions/citrate.js +14 -0
- package/_esm/chains/definitions/citrate.js.map +1 -0
- package/_esm/chains/definitions/grav.js +21 -0
- package/_esm/chains/definitions/grav.js.map +1 -0
- package/_esm/chains/definitions/ladyChain.js +19 -0
- package/_esm/chains/definitions/ladyChain.js.map +1 -0
- package/_esm/chains/definitions/tempoModerato.js +1 -0
- package/_esm/chains/definitions/tempoModerato.js.map +1 -1
- package/_esm/chains/definitions/valygoNft.js +34 -0
- package/_esm/chains/definitions/valygoNft.js.map +1 -0
- package/_esm/chains/definitions/valygoSmartchain.js +34 -0
- package/_esm/chains/definitions/valygoSmartchain.js.map +1 -0
- package/_esm/chains/index.js +5 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/tempo/Abis.js +188 -0
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Account.js +116 -24
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/Addresses.js +2 -0
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Decorator.js +23 -0
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/Formatters.js +5 -1
- package/_esm/tempo/Formatters.js.map +1 -1
- package/_esm/tempo/Hardfork.js +3 -0
- package/_esm/tempo/Hardfork.js.map +1 -1
- package/_esm/tempo/Transaction.js +34 -0
- package/_esm/tempo/Transaction.js.map +1 -1
- package/_esm/tempo/actions/accessKey.js +562 -128
- package/_esm/tempo/actions/accessKey.js.map +1 -1
- package/_esm/tempo/actions/index.js +1 -0
- package/_esm/tempo/actions/index.js.map +1 -1
- package/_esm/tempo/actions/receivePolicy.js +753 -0
- package/_esm/tempo/actions/receivePolicy.js.map +1 -0
- package/_esm/tempo/chainConfig.js +24 -1
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/index.js +1 -1
- package/_esm/tempo/index.js.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts +12 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/chains/definitions/citrate.d.ts +57 -0
- package/_types/chains/definitions/citrate.d.ts.map +1 -0
- package/_types/chains/definitions/grav.d.ts +43 -0
- package/_types/chains/definitions/grav.d.ts.map +1 -0
- package/_types/chains/definitions/ladyChain.d.ts +50 -0
- package/_types/chains/definitions/ladyChain.d.ts.map +1 -0
- package/_types/chains/definitions/tempo.d.ts +36 -0
- package/_types/chains/definitions/tempo.d.ts.map +1 -1
- package/_types/chains/definitions/tempoDevnet.d.ts +36 -0
- package/_types/chains/definitions/tempoDevnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoLocalnet.d.ts +36 -0
- package/_types/chains/definitions/tempoLocalnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoModerato.d.ts +38 -0
- package/_types/chains/definitions/tempoModerato.d.ts.map +1 -1
- package/_types/chains/definitions/valygoNft.d.ts +48 -0
- package/_types/chains/definitions/valygoNft.d.ts.map +1 -0
- package/_types/chains/definitions/valygoSmartchain.d.ts +48 -0
- package/_types/chains/definitions/valygoSmartchain.d.ts.map +1 -0
- package/_types/chains/index.d.ts +5 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/tempo/Abis.d.ts +671 -4
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +61 -3
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/Addresses.d.ts +2 -0
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +501 -0
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/Formatters.d.ts.map +1 -1
- package/_types/tempo/Hardfork.d.ts +1 -1
- package/_types/tempo/Hardfork.d.ts.map +1 -1
- package/_types/tempo/Transaction.d.ts +5 -1
- package/_types/tempo/Transaction.d.ts.map +1 -1
- package/_types/tempo/actions/accessKey.d.ts +1520 -304
- package/_types/tempo/actions/accessKey.d.ts.map +1 -1
- package/_types/tempo/actions/dex.d.ts +75 -0
- package/_types/tempo/actions/dex.d.ts.map +1 -1
- package/_types/tempo/actions/index.d.ts +1 -0
- package/_types/tempo/actions/index.d.ts.map +1 -1
- package/_types/tempo/actions/policy.d.ts +352 -0
- package/_types/tempo/actions/policy.d.ts.map +1 -1
- package/_types/tempo/actions/receivePolicy.d.ts +1511 -0
- package/_types/tempo/actions/receivePolicy.d.ts.map +1 -0
- package/_types/tempo/chainConfig.d.ts +34 -15
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +1 -1
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/tempo/zones/zone.d.ts +108 -0
- package/_types/tempo/zones/zone.d.ts.map +1 -1
- package/actions/wallet/prepareTransactionRequest.ts +40 -5
- package/chains/definitions/citrate.ts +14 -0
- package/chains/definitions/grav.ts +21 -0
- package/chains/definitions/ladyChain.ts +19 -0
- package/chains/definitions/tempoModerato.ts +1 -0
- package/chains/definitions/valygoNft.ts +34 -0
- package/chains/definitions/valygoSmartchain.ts +34 -0
- package/chains/index.ts +5 -0
- package/errors/version.ts +1 -1
- package/package.json +3 -4
- package/tempo/Abis.ts +189 -0
- package/tempo/Account.ts +153 -31
- package/tempo/Addresses.ts +2 -0
- package/tempo/Decorator.ts +578 -0
- package/tempo/Formatters.ts +12 -1
- package/tempo/Hardfork.ts +3 -0
- package/tempo/Transaction.ts +42 -0
- package/tempo/actions/accessKey.ts +1002 -279
- package/tempo/actions/index.ts +1 -0
- package/tempo/actions/receivePolicy.ts +1266 -0
- package/tempo/chainConfig.ts +32 -3
- package/tempo/index.ts +2 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const valygoSmartchain = defineChain({
|
|
4
|
+
id: 7_771_777,
|
|
5
|
+
name: 'VALYGO Smartchain',
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 18,
|
|
8
|
+
name: 'VYO',
|
|
9
|
+
symbol: 'VYO',
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: {
|
|
13
|
+
http: [
|
|
14
|
+
'https://rpc-gw-1.vyoscan.com/ext/bc/2t51dXsuxUvd9teY9TKEJmgxmxMk3CRF88UYTA4HQgjeYZqzSX/rpc',
|
|
15
|
+
'https://rpc-gw-2.vyoscan.com/ext/bc/2t51dXsuxUvd9teY9TKEJmgxmxMk3CRF88UYTA4HQgjeYZqzSX/rpc',
|
|
16
|
+
],
|
|
17
|
+
webSocket: [
|
|
18
|
+
'wss://ws.vyoscan.com/ext/bc/2t51dXsuxUvd9teY9TKEJmgxmxMk3CRF88UYTA4HQgjeYZqzSX/ws',
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
blockExplorers: {
|
|
23
|
+
default: {
|
|
24
|
+
name: 'VYOScan',
|
|
25
|
+
url: 'https://vyoscan.com',
|
|
26
|
+
apiUrl: 'https://vyoscan.com/api',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
contracts: {
|
|
30
|
+
multicall3: {
|
|
31
|
+
address: '0xeFa3c632BD275750597cE9ca2346A5becAA0F344',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
})
|
package/chains/index.ts
CHANGED
|
@@ -114,6 +114,7 @@ export { celoSepolia } from './definitions/celoSepolia.js'
|
|
|
114
114
|
export { chang } from './definitions/chang.js'
|
|
115
115
|
export { chiliz } from './definitions/chiliz.js'
|
|
116
116
|
export { chips } from './definitions/chips.js'
|
|
117
|
+
export { citrate } from './definitions/citrate.js'
|
|
117
118
|
export { citrea } from './definitions/citrea.js'
|
|
118
119
|
export { citreaTestnet } from './definitions/citreaTestnet.js'
|
|
119
120
|
export { classic } from './definitions/classic.js'
|
|
@@ -251,6 +252,7 @@ export { godwoken } from './definitions/godwoken.js'
|
|
|
251
252
|
export { goerli } from './definitions/goerli.js'
|
|
252
253
|
export { graphite } from './definitions/graphite.js'
|
|
253
254
|
export { graphiteTestnet } from './definitions/graphiteTestnet.js'
|
|
255
|
+
export { grav } from './definitions/grav.js'
|
|
254
256
|
export { gravity } from './definitions/gravity.js'
|
|
255
257
|
export { gunz } from './definitions/gunz.js'
|
|
256
258
|
export { guruNetwork } from './definitions/guruNetwork.js'
|
|
@@ -350,6 +352,7 @@ export { kromaSepolia } from './definitions/kromaSepolia.js'
|
|
|
350
352
|
export { krown } from './definitions/krown.js'
|
|
351
353
|
export { l3x } from './definitions/l3x.js'
|
|
352
354
|
export { l3xTestnet } from './definitions/l3xTestnet.js'
|
|
355
|
+
export { ladyChain } from './definitions/ladyChain.js'
|
|
353
356
|
export { lavita } from './definitions/lavita.js'
|
|
354
357
|
export { lens } from './definitions/lens.js'
|
|
355
358
|
export { lensTestnet } from './definitions/lensTestnet.js'
|
|
@@ -675,6 +678,8 @@ export { unique } from './definitions/unique.js'
|
|
|
675
678
|
export { uniqueOpal } from './definitions/uniqueOpal.js'
|
|
676
679
|
export { uniqueQuartz } from './definitions/uniqueQuartz.js'
|
|
677
680
|
export { unreal } from './definitions/unreal.js'
|
|
681
|
+
export { valygoNft } from './definitions/valygoNft.js'
|
|
682
|
+
export { valygoSmartchain } from './definitions/valygoSmartchain.js'
|
|
678
683
|
export { vana } from './definitions/vana.js'
|
|
679
684
|
export { vanaMoksha } from './definitions/vanaMoksha.js'
|
|
680
685
|
export { vanar } from './definitions/vanar.js'
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.
|
|
1
|
+
export const version = '2.52.2'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viem",
|
|
3
3
|
"description": "TypeScript Interface for Ethereum",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.52.2",
|
|
5
5
|
"main": "./_cjs/index.js",
|
|
6
6
|
"module": "./_esm/index.js",
|
|
7
7
|
"types": "./_types/index.d.ts",
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
"!**/*.test.ts.snap",
|
|
16
16
|
"!**/*.test-d.ts",
|
|
17
17
|
"!**/*.tsbuildinfo",
|
|
18
|
-
"!tsconfig.build.json"
|
|
19
|
-
"!jsr.json"
|
|
18
|
+
"!tsconfig.build.json"
|
|
20
19
|
],
|
|
21
20
|
"exports": {
|
|
22
21
|
".": {
|
|
@@ -230,7 +229,7 @@
|
|
|
230
229
|
"@scure/bip39": "1.6.0",
|
|
231
230
|
"abitype": "1.2.3",
|
|
232
231
|
"isows": "1.0.7",
|
|
233
|
-
"ox": "0.14.
|
|
232
|
+
"ox": "0.14.29",
|
|
234
233
|
"ws": "8.20.1"
|
|
235
234
|
},
|
|
236
235
|
"license": "MIT",
|
package/tempo/Abis.ts
CHANGED
|
@@ -1294,6 +1294,28 @@ export const signatureVerifier = [
|
|
|
1294
1294
|
],
|
|
1295
1295
|
outputs: [{ type: 'bool' }],
|
|
1296
1296
|
},
|
|
1297
|
+
{
|
|
1298
|
+
name: 'verifyKeychain',
|
|
1299
|
+
type: 'function',
|
|
1300
|
+
stateMutability: 'view',
|
|
1301
|
+
inputs: [
|
|
1302
|
+
{ type: 'address', name: 'account' },
|
|
1303
|
+
{ type: 'bytes32', name: 'hash' },
|
|
1304
|
+
{ type: 'bytes', name: 'signature' },
|
|
1305
|
+
],
|
|
1306
|
+
outputs: [{ type: 'bool' }],
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
name: 'verifyKeychainAdmin',
|
|
1310
|
+
type: 'function',
|
|
1311
|
+
stateMutability: 'view',
|
|
1312
|
+
inputs: [
|
|
1313
|
+
{ type: 'address', name: 'account' },
|
|
1314
|
+
{ type: 'bytes32', name: 'hash' },
|
|
1315
|
+
{ type: 'bytes', name: 'signature' },
|
|
1316
|
+
],
|
|
1317
|
+
outputs: [{ type: 'bool' }],
|
|
1318
|
+
},
|
|
1297
1319
|
{ name: 'InvalidFormat', type: 'error', inputs: [] },
|
|
1298
1320
|
{ name: 'InvalidSignature', type: 'error', inputs: [] },
|
|
1299
1321
|
] as const
|
|
@@ -1594,6 +1616,15 @@ export const stablecoinDex = [
|
|
|
1594
1616
|
{ type: 'int16', name: 'flipTick' },
|
|
1595
1617
|
],
|
|
1596
1618
|
},
|
|
1619
|
+
{
|
|
1620
|
+
name: 'FlipFailed',
|
|
1621
|
+
type: 'event',
|
|
1622
|
+
inputs: [
|
|
1623
|
+
{ type: 'uint128', name: 'orderId', indexed: true },
|
|
1624
|
+
{ type: 'address', name: 'maker', indexed: true },
|
|
1625
|
+
{ type: 'bytes4', name: 'reason' },
|
|
1626
|
+
],
|
|
1627
|
+
},
|
|
1597
1628
|
{
|
|
1598
1629
|
name: 'OrderCancelled',
|
|
1599
1630
|
type: 'event',
|
|
@@ -1949,6 +1980,82 @@ export const feeAmm = [
|
|
|
1949
1980
|
{ name: 'InvalidSwapCalculation', type: 'error', inputs: [] },
|
|
1950
1981
|
] as const
|
|
1951
1982
|
|
|
1983
|
+
export const receivePolicyGuard = [
|
|
1984
|
+
{
|
|
1985
|
+
name: 'balanceOf',
|
|
1986
|
+
type: 'function',
|
|
1987
|
+
stateMutability: 'view',
|
|
1988
|
+
inputs: [{ type: 'bytes', name: 'receipt' }],
|
|
1989
|
+
outputs: [{ type: 'uint256', name: 'amount' }],
|
|
1990
|
+
},
|
|
1991
|
+
{
|
|
1992
|
+
name: 'claim',
|
|
1993
|
+
type: 'function',
|
|
1994
|
+
stateMutability: 'nonpayable',
|
|
1995
|
+
inputs: [
|
|
1996
|
+
{ type: 'address', name: 'to' },
|
|
1997
|
+
{ type: 'bytes', name: 'receipt' },
|
|
1998
|
+
],
|
|
1999
|
+
outputs: [],
|
|
2000
|
+
},
|
|
2001
|
+
{
|
|
2002
|
+
name: 'burnBlockedReceipt',
|
|
2003
|
+
type: 'function',
|
|
2004
|
+
stateMutability: 'nonpayable',
|
|
2005
|
+
inputs: [{ type: 'bytes', name: 'receipt' }],
|
|
2006
|
+
outputs: [],
|
|
2007
|
+
},
|
|
2008
|
+
{
|
|
2009
|
+
name: 'TransferBlocked',
|
|
2010
|
+
type: 'event',
|
|
2011
|
+
inputs: [
|
|
2012
|
+
{ type: 'address', name: 'token', indexed: true },
|
|
2013
|
+
{ type: 'address', name: 'receiver', indexed: true },
|
|
2014
|
+
{ type: 'uint64', name: 'blockedNonce', indexed: true },
|
|
2015
|
+
{ type: 'uint256', name: 'amount' },
|
|
2016
|
+
{ type: 'uint8', name: 'receiptVersion' },
|
|
2017
|
+
{ type: 'bytes', name: 'receipt' },
|
|
2018
|
+
],
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
name: 'ReceiptClaimed',
|
|
2022
|
+
type: 'event',
|
|
2023
|
+
inputs: [
|
|
2024
|
+
{ type: 'address', name: 'token', indexed: true },
|
|
2025
|
+
{ type: 'address', name: 'receiver', indexed: true },
|
|
2026
|
+
{ type: 'uint64', name: 'blockedNonce', indexed: true },
|
|
2027
|
+
{ type: 'uint64', name: 'blockedAt' },
|
|
2028
|
+
{ type: 'uint8', name: 'receiptVersion' },
|
|
2029
|
+
{ type: 'address', name: 'originator' },
|
|
2030
|
+
{ type: 'address', name: 'recipient' },
|
|
2031
|
+
{ type: 'address', name: 'recoveryAuthority' },
|
|
2032
|
+
{ type: 'address', name: 'caller' },
|
|
2033
|
+
{ type: 'address', name: 'to' },
|
|
2034
|
+
{ type: 'uint256', name: 'amount' },
|
|
2035
|
+
],
|
|
2036
|
+
},
|
|
2037
|
+
{
|
|
2038
|
+
name: 'ReceiptBurned',
|
|
2039
|
+
type: 'event',
|
|
2040
|
+
inputs: [
|
|
2041
|
+
{ type: 'address', name: 'token', indexed: true },
|
|
2042
|
+
{ type: 'address', name: 'receiver', indexed: true },
|
|
2043
|
+
{ type: 'uint64', name: 'blockedNonce', indexed: true },
|
|
2044
|
+
{ type: 'uint64', name: 'blockedAt' },
|
|
2045
|
+
{ type: 'uint8', name: 'receiptVersion' },
|
|
2046
|
+
{ type: 'address', name: 'originator' },
|
|
2047
|
+
{ type: 'address', name: 'recipient' },
|
|
2048
|
+
{ type: 'address', name: 'recoveryAuthority' },
|
|
2049
|
+
{ type: 'address', name: 'caller' },
|
|
2050
|
+
{ type: 'uint256', name: 'amount' },
|
|
2051
|
+
],
|
|
2052
|
+
},
|
|
2053
|
+
{ name: 'InvalidReceipt', type: 'error', inputs: [] },
|
|
2054
|
+
{ name: 'InvalidClaimAddress', type: 'error', inputs: [] },
|
|
2055
|
+
{ name: 'UnauthorizedClaimer', type: 'error', inputs: [] },
|
|
2056
|
+
{ name: 'AddressReserved', type: 'error', inputs: [] },
|
|
2057
|
+
] as const
|
|
2058
|
+
|
|
1952
2059
|
export const accountKeychain = [
|
|
1953
2060
|
{
|
|
1954
2061
|
name: 'authorizeKey',
|
|
@@ -2057,6 +2164,17 @@ export const accountKeychain = [
|
|
|
2057
2164
|
],
|
|
2058
2165
|
outputs: [],
|
|
2059
2166
|
},
|
|
2167
|
+
{
|
|
2168
|
+
name: 'authorizeAdminKey',
|
|
2169
|
+
type: 'function',
|
|
2170
|
+
stateMutability: 'nonpayable',
|
|
2171
|
+
inputs: [
|
|
2172
|
+
{ type: 'address', name: 'keyId' },
|
|
2173
|
+
{ type: 'uint8', name: 'signatureType' },
|
|
2174
|
+
{ type: 'bytes32', name: 'witness' },
|
|
2175
|
+
],
|
|
2176
|
+
outputs: [],
|
|
2177
|
+
},
|
|
2060
2178
|
{
|
|
2061
2179
|
name: 'burnKeyAuthorizationWitness',
|
|
2062
2180
|
type: 'function',
|
|
@@ -2199,6 +2317,16 @@ export const accountKeychain = [
|
|
|
2199
2317
|
],
|
|
2200
2318
|
outputs: [{ type: 'bool' }],
|
|
2201
2319
|
},
|
|
2320
|
+
{
|
|
2321
|
+
name: 'isAdminKey',
|
|
2322
|
+
type: 'function',
|
|
2323
|
+
stateMutability: 'view',
|
|
2324
|
+
inputs: [
|
|
2325
|
+
{ type: 'address', name: 'account' },
|
|
2326
|
+
{ type: 'address', name: 'keyId' },
|
|
2327
|
+
],
|
|
2328
|
+
outputs: [{ type: 'bool' }],
|
|
2329
|
+
},
|
|
2202
2330
|
{
|
|
2203
2331
|
name: 'getTransactionKey',
|
|
2204
2332
|
type: 'function',
|
|
@@ -2216,6 +2344,14 @@ export const accountKeychain = [
|
|
|
2216
2344
|
{ type: 'uint64', name: 'expiry' },
|
|
2217
2345
|
],
|
|
2218
2346
|
},
|
|
2347
|
+
{
|
|
2348
|
+
name: 'AdminKeyAuthorized',
|
|
2349
|
+
type: 'event',
|
|
2350
|
+
inputs: [
|
|
2351
|
+
{ type: 'address', name: 'account', indexed: true },
|
|
2352
|
+
{ type: 'address', name: 'publicKey', indexed: true },
|
|
2353
|
+
],
|
|
2354
|
+
},
|
|
2219
2355
|
{
|
|
2220
2356
|
name: 'KeyRevoked',
|
|
2221
2357
|
type: 'event',
|
|
@@ -2281,6 +2417,7 @@ export const accountKeychain = [
|
|
|
2281
2417
|
},
|
|
2282
2418
|
{ name: 'CallNotAllowed', type: 'error', inputs: [] },
|
|
2283
2419
|
{ name: 'InvalidCallScope', type: 'error', inputs: [] },
|
|
2420
|
+
{ name: 'InvalidKeyId', type: 'error', inputs: [] },
|
|
2284
2421
|
{ name: 'InvalidKeyAuthorizationWitness', type: 'error', inputs: [] },
|
|
2285
2422
|
{ name: 'KeyAuthorizationWitnessAlreadyBurned', type: 'error', inputs: [] },
|
|
2286
2423
|
{
|
|
@@ -2464,6 +2601,34 @@ export const tip403Registry = [
|
|
|
2464
2601
|
{ type: 'uint64', name: 'mintRecipientPolicyId' },
|
|
2465
2602
|
],
|
|
2466
2603
|
},
|
|
2604
|
+
{
|
|
2605
|
+
name: 'receivePolicy',
|
|
2606
|
+
type: 'function',
|
|
2607
|
+
stateMutability: 'view',
|
|
2608
|
+
inputs: [{ type: 'address', name: 'account' }],
|
|
2609
|
+
outputs: [
|
|
2610
|
+
{ type: 'bool', name: 'hasReceivePolicy' },
|
|
2611
|
+
{ type: 'uint64', name: 'senderPolicyId' },
|
|
2612
|
+
{ type: 'uint8', name: 'senderPolicyType' },
|
|
2613
|
+
{ type: 'uint64', name: 'tokenFilterId' },
|
|
2614
|
+
{ type: 'uint8', name: 'tokenFilterType' },
|
|
2615
|
+
{ type: 'address', name: 'recoveryAuthority' },
|
|
2616
|
+
],
|
|
2617
|
+
},
|
|
2618
|
+
{
|
|
2619
|
+
name: 'validateReceivePolicy',
|
|
2620
|
+
type: 'function',
|
|
2621
|
+
stateMutability: 'view',
|
|
2622
|
+
inputs: [
|
|
2623
|
+
{ type: 'address', name: 'token' },
|
|
2624
|
+
{ type: 'address', name: 'sender' },
|
|
2625
|
+
{ type: 'address', name: 'receiver' },
|
|
2626
|
+
],
|
|
2627
|
+
outputs: [
|
|
2628
|
+
{ type: 'bool', name: 'authorized' },
|
|
2629
|
+
{ type: 'uint8', name: 'blockedReason' },
|
|
2630
|
+
],
|
|
2631
|
+
},
|
|
2467
2632
|
{
|
|
2468
2633
|
name: 'createPolicy',
|
|
2469
2634
|
type: 'function',
|
|
@@ -2528,6 +2693,17 @@ export const tip403Registry = [
|
|
|
2528
2693
|
],
|
|
2529
2694
|
outputs: [{ type: 'uint64' }],
|
|
2530
2695
|
},
|
|
2696
|
+
{
|
|
2697
|
+
name: 'setReceivePolicy',
|
|
2698
|
+
type: 'function',
|
|
2699
|
+
stateMutability: 'nonpayable',
|
|
2700
|
+
inputs: [
|
|
2701
|
+
{ type: 'uint64', name: 'senderPolicyId' },
|
|
2702
|
+
{ type: 'uint64', name: 'tokenFilterId' },
|
|
2703
|
+
{ type: 'address', name: 'recoveryAuthority' },
|
|
2704
|
+
],
|
|
2705
|
+
outputs: [],
|
|
2706
|
+
},
|
|
2531
2707
|
{
|
|
2532
2708
|
name: 'PolicyAdminUpdated',
|
|
2533
2709
|
type: 'event',
|
|
@@ -2577,12 +2753,24 @@ export const tip403Registry = [
|
|
|
2577
2753
|
{ type: 'uint64', name: 'mintRecipientPolicyId' },
|
|
2578
2754
|
],
|
|
2579
2755
|
},
|
|
2756
|
+
{
|
|
2757
|
+
name: 'ReceivePolicyUpdated',
|
|
2758
|
+
type: 'event',
|
|
2759
|
+
inputs: [
|
|
2760
|
+
{ type: 'address', name: 'account', indexed: true },
|
|
2761
|
+
{ type: 'uint64', name: 'senderPolicyId' },
|
|
2762
|
+
{ type: 'uint64', name: 'tokenFilterId' },
|
|
2763
|
+
{ type: 'address', name: 'recoveryAuthority' },
|
|
2764
|
+
],
|
|
2765
|
+
},
|
|
2580
2766
|
{ name: 'Unauthorized', type: 'error', inputs: [] },
|
|
2581
2767
|
{ name: 'PolicyNotFound', type: 'error', inputs: [] },
|
|
2582
2768
|
{ name: 'PolicyNotSimple', type: 'error', inputs: [] },
|
|
2583
2769
|
{ name: 'InvalidPolicyType', type: 'error', inputs: [] },
|
|
2584
2770
|
{ name: 'IncompatiblePolicyType', type: 'error', inputs: [] },
|
|
2585
2771
|
{ name: 'VirtualAddressNotAllowed', type: 'error', inputs: [] },
|
|
2772
|
+
{ name: 'InvalidReceivePolicyType', type: 'error', inputs: [] },
|
|
2773
|
+
{ name: 'InvalidRecoveryAuthority', type: 'error', inputs: [] },
|
|
2586
2774
|
] as const
|
|
2587
2775
|
|
|
2588
2776
|
export const validatorConfig = [
|
|
@@ -2745,6 +2933,7 @@ export const abis = [
|
|
|
2745
2933
|
...addressRegistry,
|
|
2746
2934
|
...feeManager,
|
|
2747
2935
|
...feeAmm,
|
|
2936
|
+
...receivePolicyGuard,
|
|
2748
2937
|
...accountKeychain,
|
|
2749
2938
|
...nonce,
|
|
2750
2939
|
...tip20Factory,
|
package/tempo/Account.ts
CHANGED
|
@@ -4,7 +4,12 @@ import * as P256 from 'ox/P256'
|
|
|
4
4
|
import * as PublicKey from 'ox/PublicKey'
|
|
5
5
|
import * as Secp256k1 from 'ox/Secp256k1'
|
|
6
6
|
import * as Signature from 'ox/Signature'
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
Channel,
|
|
9
|
+
KeyAuthorization,
|
|
10
|
+
MultisigConfig,
|
|
11
|
+
SignatureEnvelope,
|
|
12
|
+
} from 'ox/tempo'
|
|
8
13
|
import * as WebAuthnP256 from 'ox/WebAuthnP256'
|
|
9
14
|
import * as WebCryptoP256 from 'ox/WebCryptoP256'
|
|
10
15
|
import type {
|
|
@@ -55,8 +60,11 @@ export type RootAccount = Account_base<'root'> & {
|
|
|
55
60
|
key: resolveAccessKey.Parameters,
|
|
56
61
|
parameters: Pick<
|
|
57
62
|
KeyAuthorization.KeyAuthorization,
|
|
58
|
-
'chainId' | 'expiry' | 'limits' | 'scopes'
|
|
59
|
-
|
|
63
|
+
'chainId' | 'expiry' | 'limits' | 'scopes' | 'witness'
|
|
64
|
+
> & {
|
|
65
|
+
/** Whether to authorize the key as an admin key (TIP-1049). */
|
|
66
|
+
admin?: boolean | undefined
|
|
67
|
+
},
|
|
60
68
|
) => Promise<KeyAuthorization.Signed>
|
|
61
69
|
}
|
|
62
70
|
|
|
@@ -266,6 +274,78 @@ export declare namespace fromSecp256k1 {
|
|
|
266
274
|
from.ReturnValue<options>
|
|
267
275
|
}
|
|
268
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Instantiates a synthetic Account for a native multisig (TIP-1061) config.
|
|
279
|
+
*
|
|
280
|
+
* The returned account does not hold a key. It is used purely to drive the
|
|
281
|
+
* standard `sendTransaction` flow: it derives the multisig address from the
|
|
282
|
+
* config and passes the prepared request (carrying the collected owner
|
|
283
|
+
* `signatures`) through to the chain serializer, which combines the approvals
|
|
284
|
+
* into the multisig signature envelope.
|
|
285
|
+
*
|
|
286
|
+
* Owner approvals are produced separately by signing with `multisig` request
|
|
287
|
+
* metadata (see `signTransaction`), and provided here via `signatures`.
|
|
288
|
+
*
|
|
289
|
+
* Accepts a raw config and normalizes it internally (via `MultisigConfig.from`),
|
|
290
|
+
* so callers don't need to call `MultisigConfig.from` themselves.
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```ts
|
|
294
|
+
* import { Account } from 'viem/tempo'
|
|
295
|
+
*
|
|
296
|
+
* const account = Account.fromMultisig({
|
|
297
|
+
* threshold: 2,
|
|
298
|
+
* owners: [
|
|
299
|
+
* { owner: owner_1.address, weight: 1 },
|
|
300
|
+
* { owner: owner_2.address, weight: 1 },
|
|
301
|
+
* ],
|
|
302
|
+
* })
|
|
303
|
+
*
|
|
304
|
+
* // Pass the account to `prepareTransactionRequest` — the multisig config is
|
|
305
|
+
* // inferred from it, so no `multisig` field is needed.
|
|
306
|
+
* const request = await client.prepareTransactionRequest({ account, ...rest })
|
|
307
|
+
*
|
|
308
|
+
* // The prepared request carries the multisig account as sender, so it doesn't
|
|
309
|
+
* // need to be re-passed to `sendTransaction`.
|
|
310
|
+
* const transaction = await client.sendTransaction({
|
|
311
|
+
* ...request,
|
|
312
|
+
* signatures: [signature_1, signature_2],
|
|
313
|
+
* })
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* @param config Multisig config (raw or from `MultisigConfig.from`).
|
|
317
|
+
* @returns Multisig account.
|
|
318
|
+
*/
|
|
319
|
+
export function fromMultisig(config: MultisigConfig.Config): MultisigAccount {
|
|
320
|
+
const normalized = MultisigConfig.from(config)
|
|
321
|
+
const address = Address.checksum(MultisigConfig.getAddress(normalized))
|
|
322
|
+
return {
|
|
323
|
+
address,
|
|
324
|
+
config: normalized,
|
|
325
|
+
publicKey: '0x',
|
|
326
|
+
source: 'multisig',
|
|
327
|
+
type: 'local',
|
|
328
|
+
async sign() {
|
|
329
|
+
throw new Error('`sign` is not supported for multisig accounts.')
|
|
330
|
+
},
|
|
331
|
+
async signMessage() {
|
|
332
|
+
throw new Error('`signMessage` is not supported for multisig accounts.')
|
|
333
|
+
},
|
|
334
|
+
async signTransaction(transaction, options) {
|
|
335
|
+
const { serializer = Transaction.serialize } = options ?? {}
|
|
336
|
+
return (await serializer(transaction as never)) as Hex.Hex
|
|
337
|
+
},
|
|
338
|
+
async signTypedData() {
|
|
339
|
+
throw new Error('`signTypedData` is not supported for multisig accounts.')
|
|
340
|
+
},
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export type MultisigAccount = LocalAccount<'multisig'> & {
|
|
345
|
+
/** Multisig config (from `MultisigConfig.from`). */
|
|
346
|
+
config: MultisigConfig.Config
|
|
347
|
+
}
|
|
348
|
+
|
|
269
349
|
/**
|
|
270
350
|
* Instantiates an Account from a WebAuthn credential.
|
|
271
351
|
*
|
|
@@ -462,36 +542,58 @@ export async function signKeyAuthorization(
|
|
|
462
542
|
account: LocalAccount,
|
|
463
543
|
parameters: signKeyAuthorization.Parameters,
|
|
464
544
|
): Promise<signKeyAuthorization.ReturnValue> {
|
|
465
|
-
const { chainId, key, expiry, limits, scopes } = parameters
|
|
545
|
+
const { chainId, key, expiry, limits, scopes, witness, admin } = parameters
|
|
466
546
|
const { accessKeyAddress, keyType: type } = resolveAccessKey(key)
|
|
467
547
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
548
|
+
// When the signer is an admin access key, the authorization must be
|
|
549
|
+
// signed directly by that key and bound to the parent account it acts
|
|
550
|
+
// on behalf of, so the signed payload cannot be replayed against another
|
|
551
|
+
// account. [TIP-1049]
|
|
552
|
+
const isAccessKey = isAccessKeyAccount(account)
|
|
553
|
+
const boundFields = isAccessKey ? { account: account.address } : {}
|
|
554
|
+
|
|
555
|
+
// Admin key authorizations are unrestricted and must not carry expiry,
|
|
556
|
+
// limits, or call scopes (the protocol rejects them). [TIP-1049]
|
|
557
|
+
const restrictions = admin ? {} : { expiry, limits, scopes }
|
|
558
|
+
|
|
559
|
+
const hash = KeyAuthorization.getSignPayload({
|
|
560
|
+
address: accessKeyAddress,
|
|
561
|
+
chainId,
|
|
562
|
+
type,
|
|
563
|
+
witness,
|
|
564
|
+
...(admin ? { isAdmin: true } : {}),
|
|
565
|
+
...boundFields,
|
|
566
|
+
...restrictions,
|
|
567
|
+
} as never)
|
|
568
|
+
const signature = isAccessKey
|
|
569
|
+
? await account.sign({ hash, raw: true })
|
|
570
|
+
: await account.sign!({ hash })
|
|
478
571
|
return KeyAuthorization.from({
|
|
479
572
|
address: accessKeyAddress,
|
|
480
573
|
chainId,
|
|
481
|
-
expiry,
|
|
482
|
-
limits,
|
|
483
|
-
scopes,
|
|
484
574
|
signature: SignatureEnvelope.from(signature),
|
|
485
575
|
type,
|
|
486
|
-
|
|
576
|
+
...(witness ? { witness } : {}),
|
|
577
|
+
...(admin ? { isAdmin: true } : {}),
|
|
578
|
+
...boundFields,
|
|
579
|
+
...restrictions,
|
|
580
|
+
} as never)
|
|
487
581
|
}
|
|
488
582
|
|
|
489
583
|
export declare namespace signKeyAuthorization {
|
|
490
584
|
type Parameters = Pick<
|
|
491
585
|
KeyAuthorization.KeyAuthorization,
|
|
492
|
-
'chainId' | 'expiry' | 'limits' | 'scopes'
|
|
586
|
+
'chainId' | 'expiry' | 'limits' | 'scopes' | 'witness'
|
|
493
587
|
> & {
|
|
494
588
|
key: resolveAccessKey.Parameters
|
|
589
|
+
/**
|
|
590
|
+
* Whether to authorize the key as an admin key. Admin keys are
|
|
591
|
+
* unrestricted and can manage the account's other access keys; `expiry`,
|
|
592
|
+
* `limits`, and `scopes` are ignored. Requires the T6 hardfork.
|
|
593
|
+
*
|
|
594
|
+
* [TIP-1049](https://tips.sh/1049)
|
|
595
|
+
*/
|
|
596
|
+
admin?: boolean | undefined
|
|
495
597
|
}
|
|
496
598
|
|
|
497
599
|
type ReturnValue = KeyAuthorization.Signed
|
|
@@ -569,9 +671,25 @@ function fromBase(parameters: fromBase.Parameters): Account_base {
|
|
|
569
671
|
return { ...transaction, feePayerSignature: null }
|
|
570
672
|
return transaction
|
|
571
673
|
})()
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
674
|
+
|
|
675
|
+
const payload = keccak256(await serializer(presign))
|
|
676
|
+
|
|
677
|
+
// Native multisig (TIP-1061): return this owner's approval — a serialized
|
|
678
|
+
// primitive signature over the multisig owner approval digest — instead of
|
|
679
|
+
// a full serialized transaction. Approvals are combined later in
|
|
680
|
+
// `sendTransaction({ signatures })`.
|
|
681
|
+
const multisig = (
|
|
682
|
+
transaction as { multisig?: MultisigConfig.Config | undefined }
|
|
683
|
+
).multisig
|
|
684
|
+
if (multisig) {
|
|
685
|
+
const digest = MultisigConfig.getSignPayload({
|
|
686
|
+
payload,
|
|
687
|
+
genesisConfig: multisig,
|
|
688
|
+
})
|
|
689
|
+
return await sign({ hash: digest, raw: true })
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
const signature = await sign({ hash: payload })
|
|
575
693
|
const envelope = SignatureEnvelope.from(signature)
|
|
576
694
|
return await serializer(transaction, envelope as never)
|
|
577
695
|
},
|
|
@@ -618,28 +736,32 @@ function fromRoot(parameters: fromRoot.Parameters): RootAccount {
|
|
|
618
736
|
...account,
|
|
619
737
|
source: 'root',
|
|
620
738
|
async signKeyAuthorization(key, parameters) {
|
|
621
|
-
const { chainId, expiry, limits, scopes } = parameters
|
|
739
|
+
const { chainId, expiry, limits, scopes, witness, admin } = parameters
|
|
622
740
|
const { accessKeyAddress, keyType: type } = resolveAccessKey(key)
|
|
623
741
|
|
|
742
|
+
// Admin key authorizations are unrestricted and must not carry expiry,
|
|
743
|
+
// limits, or call scopes (the protocol rejects them). [TIP-1049]
|
|
744
|
+
const restrictions = admin ? {} : { expiry, limits, scopes }
|
|
745
|
+
|
|
624
746
|
const signature = await account.sign({
|
|
625
747
|
hash: KeyAuthorization.getSignPayload({
|
|
626
748
|
address: accessKeyAddress,
|
|
627
749
|
chainId,
|
|
628
|
-
expiry,
|
|
629
|
-
limits,
|
|
630
|
-
scopes,
|
|
631
750
|
type,
|
|
632
|
-
|
|
751
|
+
witness,
|
|
752
|
+
...(admin ? { isAdmin: true } : {}),
|
|
753
|
+
...restrictions,
|
|
754
|
+
} as never),
|
|
633
755
|
})
|
|
634
756
|
const keyAuthorization = KeyAuthorization.from({
|
|
635
757
|
address: accessKeyAddress,
|
|
636
758
|
chainId,
|
|
637
|
-
expiry,
|
|
638
|
-
limits,
|
|
639
|
-
scopes,
|
|
640
759
|
signature: SignatureEnvelope.from(signature),
|
|
641
760
|
type,
|
|
642
|
-
|
|
761
|
+
...(witness ? { witness } : {}),
|
|
762
|
+
...(admin ? { isAdmin: true } : {}),
|
|
763
|
+
...restrictions,
|
|
764
|
+
} as never)
|
|
643
765
|
return keyAuthorization
|
|
644
766
|
},
|
|
645
767
|
}
|
package/tempo/Addresses.ts
CHANGED
|
@@ -6,6 +6,8 @@ export const addressRegistry = '0xfdc0000000000000000000000000000000000000'
|
|
|
6
6
|
export const feeManager = '0xfeec000000000000000000000000000000000000'
|
|
7
7
|
export const nonceManager = '0x4e4F4E4345000000000000000000000000000000'
|
|
8
8
|
export const pathUsd = '0x20c0000000000000000000000000000000000000'
|
|
9
|
+
export const receivePolicyGuard = '0xB10C000000000000000000000000000000000000'
|
|
10
|
+
export const signatureVerifier = '0x5165300000000000000000000000000000000000'
|
|
9
11
|
export const stablecoinDex = '0xdec0000000000000000000000000000000000000'
|
|
10
12
|
export const tip20Factory = '0x20fc000000000000000000000000000000000000'
|
|
11
13
|
export const tip403Registry = '0x403c000000000000000000000000000000000000'
|