@privy-io/node 0.1.0-alpha.2 → 0.1.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 +40 -0
- package/client.d.mts +3 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -3
- package/client.d.ts.map +1 -1
- package/client.js +1 -1
- package/client.js.map +1 -1
- package/client.mjs +1 -1
- package/client.mjs.map +1 -1
- package/index.d.mts +6 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -1
- package/index.js +7 -1
- package/index.js.map +1 -1
- package/index.mjs +2 -0
- package/index.mjs.map +1 -1
- package/internal/utils/values.js +3 -3
- package/internal/utils/values.js.map +1 -1
- package/internal/utils/values.mjs +3 -3
- package/internal/utils/values.mjs.map +1 -1
- package/lib/auth.d.mts +68 -0
- package/lib/auth.d.mts.map +1 -0
- package/lib/auth.d.ts +68 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +130 -0
- package/lib/auth.js.map +1 -0
- package/lib/auth.mjs +123 -0
- package/lib/auth.mjs.map +1 -0
- package/lib/identity-token.d.mts +15 -0
- package/lib/identity-token.d.mts.map +1 -0
- package/lib/identity-token.d.ts +15 -0
- package/lib/identity-token.d.ts.map +1 -0
- package/lib/identity-token.js +273 -0
- package/lib/identity-token.js.map +1 -0
- package/lib/identity-token.mjs +268 -0
- package/lib/identity-token.mjs.map +1 -0
- package/lib/user-utils.d.mts +22 -0
- package/lib/user-utils.d.mts.map +1 -0
- package/lib/user-utils.d.ts +22 -0
- package/lib/user-utils.d.ts.map +1 -0
- package/lib/user-utils.js +15 -0
- package/lib/user-utils.js.map +1 -0
- package/lib/user-utils.mjs +11 -0
- package/lib/user-utils.mjs.map +1 -0
- package/package.json +19 -1
- package/public-api/PrivyClient.d.mts +2 -1
- package/public-api/PrivyClient.d.mts.map +1 -1
- package/public-api/PrivyClient.d.ts +2 -1
- package/public-api/PrivyClient.d.ts.map +1 -1
- package/public-api/PrivyClient.js +10 -3
- package/public-api/PrivyClient.js.map +1 -1
- package/public-api/PrivyClient.mjs +10 -3
- package/public-api/PrivyClient.mjs.map +1 -1
- package/public-api/services/ethereum.d.mts.map +1 -1
- package/public-api/services/ethereum.d.ts.map +1 -1
- package/public-api/services/ethereum.js +0 -6
- package/public-api/services/ethereum.js.map +1 -1
- package/public-api/services/ethereum.mjs +0 -6
- package/public-api/services/ethereum.mjs.map +1 -1
- package/public-api/services/solana.d.mts.map +1 -1
- package/public-api/services/solana.d.ts.map +1 -1
- package/public-api/services/solana.js +0 -3
- package/public-api/services/solana.js.map +1 -1
- package/public-api/services/solana.mjs +0 -3
- package/public-api/services/solana.mjs.map +1 -1
- package/public-api/services/users.d.mts +23 -1
- package/public-api/services/users.d.mts.map +1 -1
- package/public-api/services/users.d.ts +23 -1
- package/public-api/services/users.d.ts.map +1 -1
- package/public-api/services/users.js +24 -0
- package/public-api/services/users.js.map +1 -1
- package/public-api/services/users.mjs +24 -0
- package/public-api/services/users.mjs.map +1 -1
- package/public-api/services/utils/auth.d.mts +18 -0
- package/public-api/services/utils/auth.d.mts.map +1 -0
- package/public-api/services/utils/auth.d.ts +18 -0
- package/public-api/services/utils/auth.d.ts.map +1 -0
- package/public-api/services/utils/auth.js +33 -0
- package/public-api/services/utils/auth.js.map +1 -0
- package/public-api/services/utils/auth.mjs +29 -0
- package/public-api/services/utils/auth.mjs.map +1 -0
- package/public-api/services/utils/request-formatter.d.mts +5 -0
- package/public-api/services/utils/request-formatter.d.mts.map +1 -0
- package/public-api/services/utils/request-formatter.d.ts +5 -0
- package/public-api/services/utils/request-formatter.d.ts.map +1 -0
- package/public-api/services/utils/request-formatter.js +12 -0
- package/public-api/services/utils/request-formatter.js.map +1 -0
- package/public-api/services/utils/request-formatter.mjs +8 -0
- package/public-api/services/utils/request-formatter.mjs.map +1 -0
- package/public-api/services/utils/request-signer.d.mts +25 -0
- package/public-api/services/utils/request-signer.d.mts.map +1 -0
- package/public-api/services/utils/request-signer.d.ts +25 -0
- package/public-api/services/utils/request-signer.d.ts.map +1 -0
- package/public-api/services/utils/request-signer.js +17 -0
- package/public-api/services/utils/request-signer.js.map +1 -0
- package/public-api/services/utils/request-signer.mjs +13 -0
- package/public-api/services/utils/request-signer.mjs.map +1 -0
- package/public-api/services/utils.d.mts +12 -22
- package/public-api/services/utils.d.mts.map +1 -1
- package/public-api/services/utils.d.ts +12 -22
- package/public-api/services/utils.d.ts.map +1 -1
- package/public-api/services/utils.js +15 -9
- package/public-api/services/utils.js.map +1 -1
- package/public-api/services/utils.mjs +16 -10
- package/public-api/services/utils.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/policies.d.mts +2 -1
- package/resources/policies.d.mts.map +1 -1
- package/resources/policies.d.ts +2 -1
- package/resources/policies.d.ts.map +1 -1
- package/resources/users.d.mts +35 -24
- package/resources/users.d.mts.map +1 -1
- package/resources/users.d.ts +35 -24
- package/resources/users.d.ts.map +1 -1
- package/resources/users.js +16 -16
- package/resources/users.js.map +1 -1
- package/resources/users.mjs +16 -16
- package/resources/users.mjs.map +1 -1
- package/resources/wallets/wallets.d.mts +3 -18
- package/resources/wallets/wallets.d.mts.map +1 -1
- package/resources/wallets/wallets.d.ts +3 -18
- package/resources/wallets/wallets.d.ts.map +1 -1
- package/resources/wallets/wallets.js.map +1 -1
- package/resources/wallets/wallets.mjs.map +1 -1
- package/src/client.ts +4 -4
- package/src/index.ts +15 -0
- package/src/internal/utils/values.ts +3 -3
- package/src/lib/auth.ts +210 -0
- package/src/lib/identity-token.ts +280 -0
- package/src/lib/user-utils.ts +31 -0
- package/src/public-api/PrivyClient.ts +12 -2
- package/src/public-api/services/ethereum.ts +0 -8
- package/src/public-api/services/solana.ts +0 -4
- package/src/public-api/services/users.ts +36 -2
- package/src/public-api/services/utils/auth.ts +41 -0
- package/src/public-api/services/utils/request-formatter.ts +6 -0
- package/src/public-api/services/utils/request-signer.ts +35 -0
- package/src/public-api/services/utils.ts +21 -31
- package/src/resources/index.ts +1 -1
- package/src/resources/policies.ts +2 -1
- package/src/resources/users.ts +50 -29
- package/src/resources/wallets/wallets.ts +6 -30
- package/src/version.ts +1 -1
- package/src/viem.ts +223 -0
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/viem.d.mts +22 -0
- package/viem.d.mts.map +1 -0
- package/viem.d.ts +22 -0
- package/viem.d.ts.map +1 -0
- package/viem.js +183 -0
- package/viem.js.map +1 -0
- package/viem.mjs +180 -0
- package/viem.mjs.map +1 -0
package/viem.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createViemAccount = createViemAccount;
|
|
4
|
+
const accounts_1 = require("viem/accounts");
|
|
5
|
+
const utils_1 = require("viem/utils");
|
|
6
|
+
const error_1 = require("./core/error.js");
|
|
7
|
+
/**
|
|
8
|
+
* Creates a viem `Account` instance for a Privy wallet given its ID, which can be used to sign
|
|
9
|
+
* messages and send transactions with the wallet.
|
|
10
|
+
*
|
|
11
|
+
* @param client instance of the Privy client.
|
|
12
|
+
* @param input an object specifying the details of the wallet to create the viem account for.
|
|
13
|
+
* @returns viem `Account` instance for the wallet.
|
|
14
|
+
*/
|
|
15
|
+
function createViemAccount(client, { walletId, address, authorizationContext }) {
|
|
16
|
+
return (0, accounts_1.toAccount)({
|
|
17
|
+
address: address,
|
|
18
|
+
sign: async ({ hash }) => {
|
|
19
|
+
const response = await client
|
|
20
|
+
.wallets()
|
|
21
|
+
.ethereum()
|
|
22
|
+
.signSecp256k1(walletId, {
|
|
23
|
+
params: { hash },
|
|
24
|
+
...(authorizationContext ? { authorization_context: authorizationContext } : {}),
|
|
25
|
+
});
|
|
26
|
+
return response.signature;
|
|
27
|
+
},
|
|
28
|
+
signMessage: async ({ message }) => {
|
|
29
|
+
const response = await client
|
|
30
|
+
.wallets()
|
|
31
|
+
.ethereum()
|
|
32
|
+
.signMessage(walletId, {
|
|
33
|
+
message: formatViemPersonalSignMessage(message),
|
|
34
|
+
...(authorizationContext ? { authorization_context: authorizationContext } : {}),
|
|
35
|
+
});
|
|
36
|
+
return response.signature;
|
|
37
|
+
},
|
|
38
|
+
signTypedData: async (typedData) => {
|
|
39
|
+
const { message, domain, types, primaryType } = replaceBigInts(typedData, utils_1.toHex);
|
|
40
|
+
// Viem accepts undefined `domain`, `message`, and `types` in this method
|
|
41
|
+
// though those are required per the EIP712 spec.
|
|
42
|
+
if (!domain)
|
|
43
|
+
throw new error_1.PrivyAPIError('typedData.domain must be defined');
|
|
44
|
+
if (!message)
|
|
45
|
+
throw new error_1.PrivyAPIError('typedData.message must be defined');
|
|
46
|
+
if (!types)
|
|
47
|
+
throw new error_1.PrivyAPIError('typedData.message must be defined');
|
|
48
|
+
const { signature } = await client
|
|
49
|
+
.wallets()
|
|
50
|
+
.ethereum()
|
|
51
|
+
.signTypedData(walletId, {
|
|
52
|
+
params: {
|
|
53
|
+
typed_data: { domain, message, primary_type: primaryType, types: types },
|
|
54
|
+
},
|
|
55
|
+
...(authorizationContext ? { authorization_context: authorizationContext } : {}),
|
|
56
|
+
});
|
|
57
|
+
return signature;
|
|
58
|
+
},
|
|
59
|
+
signTransaction: async (transaction) => {
|
|
60
|
+
const { signed_transaction: signedTransaction } = await client
|
|
61
|
+
.wallets()
|
|
62
|
+
.ethereum()
|
|
63
|
+
.signTransaction(walletId, {
|
|
64
|
+
params: { transaction: formatViemTransaction(transaction) },
|
|
65
|
+
...(authorizationContext ? { authorization_context: authorizationContext } : {}),
|
|
66
|
+
});
|
|
67
|
+
return signedTransaction;
|
|
68
|
+
},
|
|
69
|
+
signAuthorization: async (parameters) => {
|
|
70
|
+
const { authorization } = await client
|
|
71
|
+
.wallets()
|
|
72
|
+
.ethereum()
|
|
73
|
+
.sign7702Authorization(walletId, {
|
|
74
|
+
params: {
|
|
75
|
+
contract: (parameters.contractAddress ?? parameters.address),
|
|
76
|
+
chain_id: parameters.chainId,
|
|
77
|
+
nonce: parameters.nonce,
|
|
78
|
+
},
|
|
79
|
+
...(authorizationContext ? { authorization_context: authorizationContext } : {}),
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
address: authorization.contract,
|
|
83
|
+
nonce: Number(authorization.nonce),
|
|
84
|
+
chainId: Number(authorization.chain_id),
|
|
85
|
+
yParity: authorization.y_parity,
|
|
86
|
+
r: authorization.r,
|
|
87
|
+
s: authorization.s,
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Formats a viem transaction type to the JSON-RPC transaction type:
|
|
94
|
+
* - 'legacy' -> 0
|
|
95
|
+
* - 'eip2930' -> 1
|
|
96
|
+
* - 'eip1559' or undefined -> 2. This is the default EVM transaction type.
|
|
97
|
+
* - 'eip4844' -> 3 in theory, but will throw an error as we do not support this yet.
|
|
98
|
+
* - 'eip7702' -> 4 in theory, but will throw an error as we do not support this yet
|
|
99
|
+
* @param type viem transaction type
|
|
100
|
+
* @returns 0 | 1 | 2
|
|
101
|
+
*/
|
|
102
|
+
const formatViemTransactionType = (type) => {
|
|
103
|
+
if (type === 'legacy') {
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
else if (type === 'eip2930') {
|
|
107
|
+
return 1;
|
|
108
|
+
}
|
|
109
|
+
else if (type == 'eip1559' || typeof type === 'undefined') {
|
|
110
|
+
// Type 2 (EIP-1559) is the default transaction type
|
|
111
|
+
return 2;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// We do not yet support EIP4844 (type 3) and EIP7702 (type 4) transaction types
|
|
115
|
+
throw new error_1.PrivyAPIError('EIP4844 and EIP7702 transaction types are not yet supported.');
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Formats viem quantities, which are represented as `bigint | undefined` to our internal
|
|
120
|
+
* `Quantity` type. This is done by converting bigints into a hexstring.
|
|
121
|
+
*
|
|
122
|
+
* @param input {bigint | undefined} bigint quantity to format
|
|
123
|
+
* @returns input as hex string
|
|
124
|
+
*/
|
|
125
|
+
const formatViemQuantity = (input) => {
|
|
126
|
+
return `0x${input.toString(16)}`;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Formats a `message` input to viem's `signMessage` function to the format needed for our wallet API.
|
|
130
|
+
*
|
|
131
|
+
* If the `message` is a string, we use it directly.
|
|
132
|
+
*
|
|
133
|
+
* If the `message` is an object containing a `raw` field, it indicates that the use case is signing raw bytes,
|
|
134
|
+
* in which case we convert `message.raw` into a `Uint8Array` before passing it to our own `signMessage`
|
|
135
|
+
* @param message input to viem's `signMessage` function
|
|
136
|
+
* @returns message as a utf-8 `string` or `Uint8Array`
|
|
137
|
+
*/
|
|
138
|
+
const formatViemPersonalSignMessage = (message) => {
|
|
139
|
+
if (typeof message === 'string')
|
|
140
|
+
return message;
|
|
141
|
+
if (typeof message.raw === 'string') {
|
|
142
|
+
// We `.slice(2)` to remove the `0x` prefix
|
|
143
|
+
return Uint8Array.from(Buffer.from(message.raw.slice(2), 'hex'));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
return message.raw;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Formats a viem transaction into our internal transaction type. For the most part, this converts
|
|
151
|
+
* bigints to hexstrings so they can be passed over the wire.
|
|
152
|
+
*
|
|
153
|
+
* @param tx input to viem's `sendTransaction` function
|
|
154
|
+
* @returns transaction {EthereumSignTransactionInputType} as our own type
|
|
155
|
+
*/
|
|
156
|
+
const formatViemTransaction = (tx) => {
|
|
157
|
+
return {
|
|
158
|
+
type: formatViemTransactionType(tx.type),
|
|
159
|
+
...(tx.to ? { to: tx.to } : {}),
|
|
160
|
+
...(tx.nonce ? { nonce: tx.nonce } : {}),
|
|
161
|
+
...(tx.chainId ? { chain_id: tx.chainId } : {}),
|
|
162
|
+
...(tx.data ? { data: tx.data } : {}),
|
|
163
|
+
...(tx.value ? { value: formatViemQuantity(tx.value) } : {}),
|
|
164
|
+
...(tx.gas ? { gas_limit: formatViemQuantity(tx.gas) } : {}),
|
|
165
|
+
...(tx.gasPrice ? { gas_price: formatViemQuantity(tx.gasPrice) } : {}),
|
|
166
|
+
...(tx.maxFeePerGas ? { max_fee_per_gas: formatViemQuantity(tx.maxFeePerGas) } : {}),
|
|
167
|
+
...(tx.maxPriorityFeePerGas ?
|
|
168
|
+
{ max_priority_fee_per_gas: formatViemQuantity(tx.maxPriorityFeePerGas) }
|
|
169
|
+
: {}),
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
const replaceBigInts = (obj, replacer) => {
|
|
173
|
+
if (typeof obj === 'bigint')
|
|
174
|
+
return replacer(obj);
|
|
175
|
+
if (Array.isArray(obj)) {
|
|
176
|
+
return obj.map((x) => replaceBigInts(x, replacer));
|
|
177
|
+
}
|
|
178
|
+
if (obj && typeof obj === 'object') {
|
|
179
|
+
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, replaceBigInts(v, replacer)]));
|
|
180
|
+
}
|
|
181
|
+
return obj;
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=viem.js.map
|
package/viem.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viem.js","sourceRoot":"","sources":["src/viem.ts"],"names":[],"mappings":";;AA8BA,8CA6EC;AA1GD,4CAKuB;AACvB,sCAAmC;AACnC,2CAA6C;AAc7C;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,MAAmB,EACnB,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,EAA0B;IAEnE,OAAO,IAAA,oBAAS,EA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js";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a viem `Account` instance for a Privy wallet given its ID, which can be used to sign
|
|
6
|
+
* messages and send transactions with the wallet.
|
|
7
|
+
*
|
|
8
|
+
* @param client instance of the Privy client.
|
|
9
|
+
* @param input an object specifying the details of the wallet to create the viem account for.
|
|
10
|
+
* @returns viem `Account` instance for the wallet.
|
|
11
|
+
*/
|
|
12
|
+
export function createViemAccount(client, { walletId, address, authorizationContext }) {
|
|
13
|
+
return toAccount({
|
|
14
|
+
address: address,
|
|
15
|
+
sign: async ({ hash }) => {
|
|
16
|
+
const response = await client
|
|
17
|
+
.wallets()
|
|
18
|
+
.ethereum()
|
|
19
|
+
.signSecp256k1(walletId, {
|
|
20
|
+
params: { hash },
|
|
21
|
+
...(authorizationContext ? { authorization_context: authorizationContext } : {}),
|
|
22
|
+
});
|
|
23
|
+
return response.signature;
|
|
24
|
+
},
|
|
25
|
+
signMessage: async ({ message }) => {
|
|
26
|
+
const response = await client
|
|
27
|
+
.wallets()
|
|
28
|
+
.ethereum()
|
|
29
|
+
.signMessage(walletId, {
|
|
30
|
+
message: formatViemPersonalSignMessage(message),
|
|
31
|
+
...(authorizationContext ? { authorization_context: authorizationContext } : {}),
|
|
32
|
+
});
|
|
33
|
+
return response.signature;
|
|
34
|
+
},
|
|
35
|
+
signTypedData: async (typedData) => {
|
|
36
|
+
const { message, domain, types, primaryType } = replaceBigInts(typedData, toHex);
|
|
37
|
+
// Viem accepts undefined `domain`, `message`, and `types` in this method
|
|
38
|
+
// though those are required per the EIP712 spec.
|
|
39
|
+
if (!domain)
|
|
40
|
+
throw new PrivyAPIError('typedData.domain must be defined');
|
|
41
|
+
if (!message)
|
|
42
|
+
throw new PrivyAPIError('typedData.message must be defined');
|
|
43
|
+
if (!types)
|
|
44
|
+
throw new PrivyAPIError('typedData.message must be defined');
|
|
45
|
+
const { signature } = await client
|
|
46
|
+
.wallets()
|
|
47
|
+
.ethereum()
|
|
48
|
+
.signTypedData(walletId, {
|
|
49
|
+
params: {
|
|
50
|
+
typed_data: { domain, message, primary_type: primaryType, types: types },
|
|
51
|
+
},
|
|
52
|
+
...(authorizationContext ? { authorization_context: authorizationContext } : {}),
|
|
53
|
+
});
|
|
54
|
+
return signature;
|
|
55
|
+
},
|
|
56
|
+
signTransaction: async (transaction) => {
|
|
57
|
+
const { signed_transaction: signedTransaction } = await client
|
|
58
|
+
.wallets()
|
|
59
|
+
.ethereum()
|
|
60
|
+
.signTransaction(walletId, {
|
|
61
|
+
params: { transaction: formatViemTransaction(transaction) },
|
|
62
|
+
...(authorizationContext ? { authorization_context: authorizationContext } : {}),
|
|
63
|
+
});
|
|
64
|
+
return signedTransaction;
|
|
65
|
+
},
|
|
66
|
+
signAuthorization: async (parameters) => {
|
|
67
|
+
const { authorization } = await client
|
|
68
|
+
.wallets()
|
|
69
|
+
.ethereum()
|
|
70
|
+
.sign7702Authorization(walletId, {
|
|
71
|
+
params: {
|
|
72
|
+
contract: (parameters.contractAddress ?? parameters.address),
|
|
73
|
+
chain_id: parameters.chainId,
|
|
74
|
+
nonce: parameters.nonce,
|
|
75
|
+
},
|
|
76
|
+
...(authorizationContext ? { authorization_context: authorizationContext } : {}),
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
address: authorization.contract,
|
|
80
|
+
nonce: Number(authorization.nonce),
|
|
81
|
+
chainId: Number(authorization.chain_id),
|
|
82
|
+
yParity: authorization.y_parity,
|
|
83
|
+
r: authorization.r,
|
|
84
|
+
s: authorization.s,
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Formats a viem transaction type to the JSON-RPC transaction type:
|
|
91
|
+
* - 'legacy' -> 0
|
|
92
|
+
* - 'eip2930' -> 1
|
|
93
|
+
* - 'eip1559' or undefined -> 2. This is the default EVM transaction type.
|
|
94
|
+
* - 'eip4844' -> 3 in theory, but will throw an error as we do not support this yet.
|
|
95
|
+
* - 'eip7702' -> 4 in theory, but will throw an error as we do not support this yet
|
|
96
|
+
* @param type viem transaction type
|
|
97
|
+
* @returns 0 | 1 | 2
|
|
98
|
+
*/
|
|
99
|
+
const formatViemTransactionType = (type) => {
|
|
100
|
+
if (type === 'legacy') {
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
else if (type === 'eip2930') {
|
|
104
|
+
return 1;
|
|
105
|
+
}
|
|
106
|
+
else if (type == 'eip1559' || typeof type === 'undefined') {
|
|
107
|
+
// Type 2 (EIP-1559) is the default transaction type
|
|
108
|
+
return 2;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
// We do not yet support EIP4844 (type 3) and EIP7702 (type 4) transaction types
|
|
112
|
+
throw new PrivyAPIError('EIP4844 and EIP7702 transaction types are not yet supported.');
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Formats viem quantities, which are represented as `bigint | undefined` to our internal
|
|
117
|
+
* `Quantity` type. This is done by converting bigints into a hexstring.
|
|
118
|
+
*
|
|
119
|
+
* @param input {bigint | undefined} bigint quantity to format
|
|
120
|
+
* @returns input as hex string
|
|
121
|
+
*/
|
|
122
|
+
const formatViemQuantity = (input) => {
|
|
123
|
+
return `0x${input.toString(16)}`;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Formats a `message` input to viem's `signMessage` function to the format needed for our wallet API.
|
|
127
|
+
*
|
|
128
|
+
* If the `message` is a string, we use it directly.
|
|
129
|
+
*
|
|
130
|
+
* If the `message` is an object containing a `raw` field, it indicates that the use case is signing raw bytes,
|
|
131
|
+
* in which case we convert `message.raw` into a `Uint8Array` before passing it to our own `signMessage`
|
|
132
|
+
* @param message input to viem's `signMessage` function
|
|
133
|
+
* @returns message as a utf-8 `string` or `Uint8Array`
|
|
134
|
+
*/
|
|
135
|
+
const formatViemPersonalSignMessage = (message) => {
|
|
136
|
+
if (typeof message === 'string')
|
|
137
|
+
return message;
|
|
138
|
+
if (typeof message.raw === 'string') {
|
|
139
|
+
// We `.slice(2)` to remove the `0x` prefix
|
|
140
|
+
return Uint8Array.from(Buffer.from(message.raw.slice(2), 'hex'));
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
return message.raw;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Formats a viem transaction into our internal transaction type. For the most part, this converts
|
|
148
|
+
* bigints to hexstrings so they can be passed over the wire.
|
|
149
|
+
*
|
|
150
|
+
* @param tx input to viem's `sendTransaction` function
|
|
151
|
+
* @returns transaction {EthereumSignTransactionInputType} as our own type
|
|
152
|
+
*/
|
|
153
|
+
const formatViemTransaction = (tx) => {
|
|
154
|
+
return {
|
|
155
|
+
type: formatViemTransactionType(tx.type),
|
|
156
|
+
...(tx.to ? { to: tx.to } : {}),
|
|
157
|
+
...(tx.nonce ? { nonce: tx.nonce } : {}),
|
|
158
|
+
...(tx.chainId ? { chain_id: tx.chainId } : {}),
|
|
159
|
+
...(tx.data ? { data: tx.data } : {}),
|
|
160
|
+
...(tx.value ? { value: formatViemQuantity(tx.value) } : {}),
|
|
161
|
+
...(tx.gas ? { gas_limit: formatViemQuantity(tx.gas) } : {}),
|
|
162
|
+
...(tx.gasPrice ? { gas_price: formatViemQuantity(tx.gasPrice) } : {}),
|
|
163
|
+
...(tx.maxFeePerGas ? { max_fee_per_gas: formatViemQuantity(tx.maxFeePerGas) } : {}),
|
|
164
|
+
...(tx.maxPriorityFeePerGas ?
|
|
165
|
+
{ max_priority_fee_per_gas: formatViemQuantity(tx.maxPriorityFeePerGas) }
|
|
166
|
+
: {}),
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
const replaceBigInts = (obj, replacer) => {
|
|
170
|
+
if (typeof obj === 'bigint')
|
|
171
|
+
return replacer(obj);
|
|
172
|
+
if (Array.isArray(obj)) {
|
|
173
|
+
return obj.map((x) => replaceBigInts(x, replacer));
|
|
174
|
+
}
|
|
175
|
+
if (obj && typeof obj === 'object') {
|
|
176
|
+
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, replaceBigInts(v, replacer)]));
|
|
177
|
+
}
|
|
178
|
+
return obj;
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=viem.mjs.map
|
package/viem.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viem.mjs","sourceRoot":"","sources":["src/viem.ts"],"names":[],"mappings":"OACO,EAIL,SAAS,GACV,MAAM,eAAe;OACf,EAAE,KAAK,EAAE,MAAM,YAAY;OAC3B,EAAE,aAAa,EAAE;AAcxB;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAmB,EACnB,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,EAA0B;IAEnE,OAAO,SAAS,CAAC;QACf,OAAO,EAAE,OAAc;QACvB,IAAI,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACvB,MAAM,QAAQ,GAAG,MAAM,MAAM;iBAC1B,OAAO,EAAE;iBACT,QAAQ,EAAE;iBACV,aAAa,CAAC,QAAQ,EAAE;gBACvB,MAAM,EAAE,EAAE,IAAI,EAAE;gBAChB,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACjF,CAAC,CAAC;YACL,OAAO,QAAQ,CAAC,SAA0B,CAAC;QAC7C,CAAC;QACD,WAAW,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;YACjC,MAAM,QAAQ,GAAG,MAAM,MAAM;iBAC1B,OAAO,EAAE;iBACT,QAAQ,EAAE;iBACV,WAAW,CAAC,QAAQ,EAAE;gBACrB,OAAO,EAAE,6BAA6B,CAAC,OAAO,CAAC;gBAC/C,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC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