tempo.ts 0.7.6 → 0.8.0
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 +26 -0
- package/dist/chains.d.ts +6 -20
- package/dist/chains.d.ts.map +1 -1
- package/dist/chains.js +14 -15
- package/dist/chains.js.map +1 -1
- package/dist/ox/KeyAuthorization.d.ts +356 -0
- package/dist/ox/KeyAuthorization.d.ts.map +1 -0
- package/dist/ox/KeyAuthorization.js +360 -0
- package/dist/ox/KeyAuthorization.js.map +1 -0
- package/dist/ox/SignatureEnvelope.d.ts +21 -6
- package/dist/ox/SignatureEnvelope.d.ts.map +1 -1
- package/dist/ox/SignatureEnvelope.js +43 -3
- package/dist/ox/SignatureEnvelope.js.map +1 -1
- package/dist/ox/Transaction.d.ts +5 -1
- package/dist/ox/Transaction.d.ts.map +1 -1
- package/dist/ox/Transaction.js +5 -0
- package/dist/ox/Transaction.js.map +1 -1
- package/dist/ox/TransactionEnvelopeAA.d.ts +9 -0
- package/dist/ox/TransactionEnvelopeAA.d.ts.map +1 -1
- package/dist/ox/TransactionEnvelopeAA.js +17 -4
- package/dist/ox/TransactionEnvelopeAA.js.map +1 -1
- package/dist/ox/TransactionRequest.d.ts +7 -1
- package/dist/ox/TransactionRequest.d.ts.map +1 -1
- package/dist/ox/TransactionRequest.js +12 -0
- package/dist/ox/TransactionRequest.js.map +1 -1
- package/dist/ox/index.d.ts +1 -0
- package/dist/ox/index.d.ts.map +1 -1
- package/dist/ox/index.js +1 -0
- package/dist/ox/index.js.map +1 -1
- package/dist/prool/Instance.js +1 -1
- package/dist/prool/Instance.js.map +1 -1
- package/{src/prool/internal → dist/prool}/chain.json +4 -2
- package/dist/viem/Abis.d.ts +319 -6
- package/dist/viem/Abis.d.ts.map +1 -1
- package/dist/viem/Abis.js +199 -7
- package/dist/viem/Abis.js.map +1 -1
- package/dist/viem/Account.d.ts +103 -14
- package/dist/viem/Account.d.ts.map +1 -1
- package/dist/viem/Account.js +177 -23
- package/dist/viem/Account.js.map +1 -1
- package/dist/viem/Actions/account.d.ts.map +1 -1
- package/dist/viem/Actions/account.js +4 -5
- package/dist/viem/Actions/account.js.map +1 -1
- package/dist/viem/Actions/amm.d.ts +72 -0
- package/dist/viem/Actions/amm.d.ts.map +1 -1
- package/dist/viem/Actions/dex.d.ts +156 -4
- package/dist/viem/Actions/dex.d.ts.map +1 -1
- package/dist/viem/Actions/fee.d.ts +4 -0
- package/dist/viem/Actions/fee.d.ts.map +1 -1
- package/dist/viem/Actions/reward.d.ts +78 -0
- package/dist/viem/Actions/reward.d.ts.map +1 -1
- package/dist/viem/Actions/token.d.ts +585 -0
- package/dist/viem/Actions/token.d.ts.map +1 -1
- package/dist/viem/Actions/token.js +2 -2
- package/dist/viem/Actions/token.js.map +1 -1
- package/dist/viem/Addresses.d.ts +1 -1
- package/dist/viem/Addresses.d.ts.map +1 -1
- package/dist/viem/Addresses.js +1 -1
- package/dist/viem/Addresses.js.map +1 -1
- package/dist/viem/Chain.d.ts +35 -0
- package/dist/viem/Chain.d.ts.map +1 -1
- package/dist/viem/Chain.js +37 -0
- package/dist/viem/Chain.js.map +1 -1
- package/dist/viem/Formatters.d.ts.map +1 -1
- package/dist/viem/Formatters.js +8 -7
- package/dist/viem/Formatters.js.map +1 -1
- package/dist/viem/Storage.d.ts +1 -0
- package/dist/viem/Storage.d.ts.map +1 -1
- package/dist/viem/Storage.js +21 -0
- package/dist/viem/Storage.js.map +1 -1
- package/dist/viem/TokenIds.d.ts +1 -1
- package/dist/viem/TokenIds.d.ts.map +1 -1
- package/dist/viem/TokenIds.js +1 -1
- package/dist/viem/TokenIds.js.map +1 -1
- package/dist/viem/Transaction.d.ts +9 -1
- package/dist/viem/Transaction.d.ts.map +1 -1
- package/dist/viem/Transaction.js +2 -1
- package/dist/viem/Transaction.js.map +1 -1
- package/dist/viem/WebAuthnP256.d.ts +4 -1
- package/dist/viem/WebAuthnP256.d.ts.map +1 -1
- package/dist/viem/WebAuthnP256.js +3 -1
- package/dist/viem/WebAuthnP256.js.map +1 -1
- package/dist/wagmi/Connector.d.ts +25 -8
- package/dist/wagmi/Connector.d.ts.map +1 -1
- package/dist/wagmi/Connector.js +120 -27
- package/dist/wagmi/Connector.js.map +1 -1
- package/package.json +3 -2
- package/src/chains.ts +14 -15
- package/src/ox/KeyAuthorization.test.ts +1332 -0
- package/src/ox/KeyAuthorization.ts +542 -0
- package/src/ox/SignatureEnvelope.test.ts +624 -0
- package/src/ox/SignatureEnvelope.ts +89 -9
- package/src/ox/Transaction.test.ts +214 -0
- package/src/ox/Transaction.ts +13 -1
- package/src/ox/TransactionEnvelopeAA.test.ts +164 -4
- package/src/ox/TransactionEnvelopeAA.ts +36 -3
- package/src/ox/TransactionRequest.ts +22 -1
- package/src/ox/e2e.test.ts +612 -5
- package/src/ox/index.ts +1 -0
- package/src/prool/Instance.ts +1 -1
- package/src/prool/chain.json +238 -0
- package/src/server/Handler.test.ts +20 -36
- package/src/viem/Abis.ts +200 -7
- package/src/viem/Account.test.ts +444 -0
- package/src/viem/Account.ts +355 -42
- package/src/viem/Actions/account.ts +3 -5
- package/src/viem/Actions/amm.test.ts +4 -4
- package/src/viem/Actions/token.test.ts +8 -8
- package/src/viem/Actions/token.ts +2 -2
- package/src/viem/Addresses.ts +1 -1
- package/src/viem/Chain.test.ts +168 -0
- package/src/viem/Chain.ts +37 -1
- package/src/viem/Formatters.ts +8 -7
- package/src/viem/Storage.ts +22 -0
- package/src/viem/TokenIds.ts +1 -1
- package/src/viem/Transaction.ts +14 -2
- package/src/viem/WebAuthnP256.ts +8 -2
- package/src/viem/e2e.test.ts +299 -96
- package/src/wagmi/Actions/amm.test.ts +2 -2
- package/src/wagmi/Connector.test.ts +1 -1
- package/src/wagmi/Connector.ts +184 -54
- package/src/wagmi/Hooks/amm.test.ts +4 -4
- package/src/wagmi/Hooks/fee.test.ts +10 -4
- package/src/wagmi/Hooks/token.test.ts +0 -488
- package/dist/viem/internal/account.d.ts +0 -21
- package/dist/viem/internal/account.d.ts.map +0 -1
- package/dist/viem/internal/account.js +0 -61
- package/dist/viem/internal/account.js.map +0 -1
- package/src/viem/internal/account.ts +0 -89
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import * as Hex from 'ox/Hex'
|
|
2
|
-
import * as PublicKey from 'ox/PublicKey'
|
|
3
|
-
import type { LocalAccount } from 'viem'
|
|
4
|
-
import {
|
|
5
|
-
hashAuthorization,
|
|
6
|
-
hashMessage,
|
|
7
|
-
hashTypedData,
|
|
8
|
-
keccak256,
|
|
9
|
-
} from 'viem/utils'
|
|
10
|
-
import type { RequiredBy } from '../../internal/types.js'
|
|
11
|
-
import * as SignatureEnvelope from '../../ox/SignatureEnvelope.js'
|
|
12
|
-
import * as Transaction from '../Transaction.js'
|
|
13
|
-
|
|
14
|
-
export type Account = RequiredBy<LocalAccount, 'sign' | 'signAuthorization'>
|
|
15
|
-
|
|
16
|
-
// TODO: this function will be redundant when Viem migrates to Ox.
|
|
17
|
-
/** @internal */
|
|
18
|
-
export function toPrivateKeyAccount(
|
|
19
|
-
parameters: toPrivateKeyAccount.Parameters,
|
|
20
|
-
): toPrivateKeyAccount.ReturnValue {
|
|
21
|
-
const { address, sign, source = 'privateKey' } = parameters
|
|
22
|
-
const publicKey = PublicKey.toHex(parameters.publicKey, {
|
|
23
|
-
includePrefix: false,
|
|
24
|
-
})
|
|
25
|
-
return {
|
|
26
|
-
address,
|
|
27
|
-
sign,
|
|
28
|
-
async signAuthorization(parameters) {
|
|
29
|
-
const { chainId, nonce } = parameters
|
|
30
|
-
const address = parameters.contractAddress ?? parameters.address
|
|
31
|
-
const signature = await sign({
|
|
32
|
-
hash: hashAuthorization({ address, chainId, nonce }),
|
|
33
|
-
})
|
|
34
|
-
const envelope = SignatureEnvelope.from(signature)
|
|
35
|
-
if (envelope.type !== 'secp256k1')
|
|
36
|
-
throw new Error(
|
|
37
|
-
'Unsupported signature type. Expected `secp256k1` but got `' +
|
|
38
|
-
envelope.type +
|
|
39
|
-
'`.',
|
|
40
|
-
)
|
|
41
|
-
const { r, s, yParity } = envelope.signature
|
|
42
|
-
return {
|
|
43
|
-
address,
|
|
44
|
-
chainId,
|
|
45
|
-
nonce,
|
|
46
|
-
r: Hex.fromNumber(r, { size: 32 }),
|
|
47
|
-
s: Hex.fromNumber(s, { size: 32 }),
|
|
48
|
-
yParity,
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
async signMessage(parameters) {
|
|
52
|
-
const { message } = parameters
|
|
53
|
-
const signature = await sign({ hash: hashMessage(message) })
|
|
54
|
-
const envelope = SignatureEnvelope.from(signature)
|
|
55
|
-
return SignatureEnvelope.serialize(envelope)
|
|
56
|
-
},
|
|
57
|
-
async signTransaction(transaction, options) {
|
|
58
|
-
const { serializer = Transaction.serialize } = options ?? {}
|
|
59
|
-
const signature = await sign({
|
|
60
|
-
hash: keccak256(await serializer(transaction)),
|
|
61
|
-
})
|
|
62
|
-
const envelope = SignatureEnvelope.from(signature)
|
|
63
|
-
return await serializer(transaction, envelope as never)
|
|
64
|
-
},
|
|
65
|
-
async signTypedData(typedData) {
|
|
66
|
-
const signature = await sign({ hash: hashTypedData(typedData) })
|
|
67
|
-
const envelope = SignatureEnvelope.from(signature)
|
|
68
|
-
return SignatureEnvelope.serialize(envelope)
|
|
69
|
-
},
|
|
70
|
-
publicKey,
|
|
71
|
-
source,
|
|
72
|
-
type: 'local',
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export declare namespace toPrivateKeyAccount {
|
|
77
|
-
export type Parameters = {
|
|
78
|
-
/** Address. */
|
|
79
|
-
address: Hex.Hex
|
|
80
|
-
/** Public key. */
|
|
81
|
-
publicKey: PublicKey.PublicKey
|
|
82
|
-
/** Sign function. */
|
|
83
|
-
sign: NonNullable<LocalAccount['sign']>
|
|
84
|
-
/** Source. */
|
|
85
|
-
source?: string | undefined
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export type ReturnValue = Account
|
|
89
|
-
}
|