tempo.ts 0.11.0 → 0.12.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 +67 -4
- package/README.md +3 -34
- package/dist/server/Handler.d.ts +14 -14
- package/dist/server/Handler.d.ts.map +1 -1
- package/dist/server/Handler.js +16 -17
- package/dist/server/Handler.js.map +1 -1
- package/dist/wagmi/Actions/amm.d.ts +51 -51
- package/dist/wagmi/Actions/amm.d.ts.map +1 -1
- package/dist/wagmi/Actions/amm.js +37 -37
- package/dist/wagmi/Actions/amm.js.map +1 -1
- package/dist/wagmi/Actions/dex.d.ts +129 -129
- package/dist/wagmi/Actions/dex.d.ts.map +1 -1
- package/dist/wagmi/Actions/dex.js +73 -73
- package/dist/wagmi/Actions/dex.js.map +1 -1
- package/dist/wagmi/Actions/faucet.d.ts +9 -9
- package/dist/wagmi/Actions/faucet.d.ts.map +1 -1
- package/dist/wagmi/Actions/faucet.js +7 -7
- package/dist/wagmi/Actions/faucet.js.map +1 -1
- package/dist/wagmi/Actions/fee.d.ts +17 -17
- package/dist/wagmi/Actions/fee.d.ts.map +1 -1
- package/dist/wagmi/Actions/fee.js +10 -10
- package/dist/wagmi/Actions/fee.js.map +1 -1
- package/dist/wagmi/Actions/nonce.d.ts +9 -79
- package/dist/wagmi/Actions/nonce.d.ts.map +1 -1
- package/dist/wagmi/Actions/nonce.js +7 -89
- package/dist/wagmi/Actions/nonce.js.map +1 -1
- package/dist/wagmi/Actions/policy.d.ts +69 -70
- package/dist/wagmi/Actions/policy.d.ts.map +1 -1
- package/dist/wagmi/Actions/policy.js +43 -43
- package/dist/wagmi/Actions/policy.js.map +1 -1
- package/dist/wagmi/Actions/reward.d.ts +51 -51
- package/dist/wagmi/Actions/reward.d.ts.map +1 -1
- package/dist/wagmi/Actions/reward.js +31 -31
- package/dist/wagmi/Actions/reward.js.map +1 -1
- package/dist/wagmi/Actions/token.d.ts +238 -238
- package/dist/wagmi/Actions/token.d.ts.map +1 -1
- package/dist/wagmi/Actions/token.js +136 -136
- package/dist/wagmi/Actions/token.js.map +1 -1
- package/dist/wagmi/Connector.d.ts +2 -1
- package/dist/wagmi/Connector.d.ts.map +1 -1
- package/dist/wagmi/Connector.js +83 -22
- package/dist/wagmi/Connector.js.map +1 -1
- package/dist/wagmi/Hooks/nonce.d.ts +1 -52
- package/dist/wagmi/Hooks/nonce.d.ts.map +1 -1
- package/dist/wagmi/Hooks/nonce.js +1 -70
- package/dist/wagmi/Hooks/nonce.js.map +1 -1
- package/dist/wagmi/Hooks/policy.d.ts +0 -1
- package/dist/wagmi/Hooks/policy.d.ts.map +1 -1
- package/dist/wagmi/Hooks/policy.js.map +1 -1
- package/dist/wagmi/KeyManager.d.ts +6 -3
- package/dist/wagmi/KeyManager.d.ts.map +1 -1
- package/dist/wagmi/KeyManager.js +9 -4
- package/dist/wagmi/KeyManager.js.map +1 -1
- package/package.json +2 -2
- package/src/server/Handler.test.ts +2 -2
- package/src/server/Handler.ts +16 -17
- package/src/wagmi/Actions/amm.ts +63 -63
- package/src/wagmi/Actions/dex.test.ts +1 -1
- package/src/wagmi/Actions/dex.ts +153 -153
- package/src/wagmi/Actions/faucet.ts +11 -11
- package/src/wagmi/Actions/fee.ts +20 -20
- package/src/wagmi/Actions/nonce.test.ts +1 -64
- package/src/wagmi/Actions/nonce.ts +10 -142
- package/src/wagmi/Actions/policy.ts +83 -85
- package/src/wagmi/Actions/reward.ts +64 -61
- package/src/wagmi/Actions/token.ts +287 -283
- package/src/wagmi/Connector.ts +105 -31
- package/src/wagmi/Hooks/dex.test.ts +1 -1
- package/src/wagmi/Hooks/fee.test.ts +0 -6
- package/src/wagmi/Hooks/nonce.test.ts +1 -66
- package/src/wagmi/Hooks/nonce.ts +1 -114
- package/src/wagmi/Hooks/policy.ts +0 -2
- package/src/wagmi/KeyManager.ts +18 -5
- package/dist/viem/Abis.d.ts +0 -2649
- package/dist/viem/Abis.d.ts.map +0 -1
- package/dist/viem/Abis.js +0 -1677
- package/dist/viem/Abis.js.map +0 -1
- package/dist/viem/Account.d.ts +0 -244
- package/dist/viem/Account.d.ts.map +0 -1
- package/dist/viem/Account.js +0 -382
- package/dist/viem/Account.js.map +0 -1
- package/dist/viem/Actions/amm.d.ts +0 -1991
- package/dist/viem/Actions/amm.d.ts.map +0 -1
- package/dist/viem/Actions/amm.js +0 -814
- package/dist/viem/Actions/amm.js.map +0 -1
- package/dist/viem/Actions/dex.d.ts +0 -3900
- package/dist/viem/Actions/dex.d.ts.map +0 -1
- package/dist/viem/Actions/dex.js +0 -1414
- package/dist/viem/Actions/dex.js.map +0 -1
- package/dist/viem/Actions/faucet.d.ts +0 -69
- package/dist/viem/Actions/faucet.d.ts.map +0 -1
- package/dist/viem/Actions/faucet.js +0 -73
- package/dist/viem/Actions/faucet.js.map +0 -1
- package/dist/viem/Actions/fee.d.ts +0 -360
- package/dist/viem/Actions/fee.d.ts.map +0 -1
- package/dist/viem/Actions/fee.js +0 -237
- package/dist/viem/Actions/fee.js.map +0 -1
- package/dist/viem/Actions/nonce.d.ts +0 -257
- package/dist/viem/Actions/nonce.d.ts.map +0 -1
- package/dist/viem/Actions/nonce.js +0 -228
- package/dist/viem/Actions/nonce.js.map +0 -1
- package/dist/viem/Actions/policy.d.ts +0 -1680
- package/dist/viem/Actions/policy.d.ts.map +0 -1
- package/dist/viem/Actions/policy.js +0 -875
- package/dist/viem/Actions/policy.js.map +0 -1
- package/dist/viem/Actions/reward.d.ts +0 -2422
- package/dist/viem/Actions/reward.d.ts.map +0 -1
- package/dist/viem/Actions/reward.js +0 -651
- package/dist/viem/Actions/reward.js.map +0 -1
- package/dist/viem/Actions/token.d.ts +0 -16007
- package/dist/viem/Actions/token.d.ts.map +0 -1
- package/dist/viem/Actions/token.js +0 -2936
- package/dist/viem/Actions/token.js.map +0 -1
- package/dist/viem/Addresses.d.ts +0 -9
- package/dist/viem/Addresses.d.ts.map +0 -1
- package/dist/viem/Addresses.js +0 -9
- package/dist/viem/Addresses.js.map +0 -1
- package/dist/viem/Chain.d.ts +0 -451
- package/dist/viem/Chain.d.ts.map +0 -1
- package/dist/viem/Chain.js +0 -96
- package/dist/viem/Chain.js.map +0 -1
- package/dist/viem/Formatters.d.ts +0 -10
- package/dist/viem/Formatters.d.ts.map +0 -1
- package/dist/viem/Formatters.js +0 -104
- package/dist/viem/Formatters.js.map +0 -1
- package/dist/viem/Storage.d.ts +0 -24
- package/dist/viem/Storage.d.ts.map +0 -1
- package/dist/viem/Storage.js +0 -68
- package/dist/viem/Storage.js.map +0 -1
- package/dist/viem/Transaction.d.ts +0 -76
- package/dist/viem/Transaction.d.ts.map +0 -1
- package/dist/viem/Transaction.js +0 -176
- package/dist/viem/Transaction.js.map +0 -1
- package/dist/viem/Transport.d.ts +0 -33
- package/dist/viem/Transport.d.ts.map +0 -1
- package/dist/viem/Transport.js +0 -138
- package/dist/viem/Transport.js.map +0 -1
- package/dist/viem/WebAuthnP256.d.ts +0 -82
- package/dist/viem/WebAuthnP256.d.ts.map +0 -1
- package/dist/viem/WebAuthnP256.js +0 -97
- package/dist/viem/WebAuthnP256.js.map +0 -1
- package/dist/viem/WebCryptoP256.d.ts +0 -2
- package/dist/viem/WebCryptoP256.d.ts.map +0 -1
- package/dist/viem/WebCryptoP256.js +0 -2
- package/dist/viem/WebCryptoP256.js.map +0 -1
- package/dist/viem/internal/types.d.ts +0 -20
- package/dist/viem/internal/types.d.ts.map +0 -1
- package/dist/viem/internal/types.js +0 -2
- package/dist/viem/internal/types.js.map +0 -1
- package/dist/viem/internal/utils.d.ts +0 -14
- package/dist/viem/internal/utils.d.ts.map +0 -1
- package/dist/viem/internal/utils.js +0 -33
- package/dist/viem/internal/utils.js.map +0 -1
- package/src/chains.ts +0 -54
- package/src/viem/Abis.ts +0 -1688
- package/src/viem/Account.test.ts +0 -444
- package/src/viem/Account.ts +0 -601
- package/src/viem/Actions/account.test.ts +0 -414
- package/src/viem/Actions/account.ts +0 -106
- package/src/viem/Actions/amm.test.ts +0 -381
- package/src/viem/Actions/amm.ts +0 -1227
- package/src/viem/Actions/dex.test.ts +0 -1549
- package/src/viem/Actions/dex.ts +0 -2150
- package/src/viem/Actions/faucet.ts +0 -121
- package/src/viem/Actions/fee.test.ts +0 -259
- package/src/viem/Actions/fee.ts +0 -372
- package/src/viem/Actions/index.ts +0 -9
- package/src/viem/Actions/nonce.test.ts +0 -206
- package/src/viem/Actions/nonce.ts +0 -347
- package/src/viem/Actions/policy.test.ts +0 -534
- package/src/viem/Actions/policy.ts +0 -1335
- package/src/viem/Actions/reward.test.ts +0 -434
- package/src/viem/Actions/reward.ts +0 -944
- package/src/viem/Actions/token.test.ts +0 -3029
- package/src/viem/Actions/token.ts +0 -4458
- package/src/viem/Addresses.ts +0 -9
- package/src/viem/Chain.bench-d.ts +0 -12
- package/src/viem/Chain.test.ts +0 -168
- package/src/viem/Chain.ts +0 -157
- package/src/viem/Decorator.bench-d.ts +0 -11
- package/src/viem/Decorator.test.ts +0 -39
- package/src/viem/Decorator.ts +0 -3179
- package/src/viem/Formatters.ts +0 -164
- package/src/viem/P256.ts +0 -1
- package/src/viem/Secp256k1.ts +0 -1
- package/src/viem/Storage.ts +0 -110
- package/src/viem/TokenIds.ts +0 -1
- package/src/viem/Transaction.ts +0 -382
- package/src/viem/Transport.ts +0 -191
- package/src/viem/WebAuthnP256.ts +0 -146
- package/src/viem/WebCryptoP256.ts +0 -1
- package/src/viem/e2e.test.ts +0 -1602
- package/src/viem/index.ts +0 -30
- package/src/viem/internal/types.ts +0 -69
- package/src/viem/internal/utils.ts +0 -58
- package/src/wagmi/internal/types.ts +0 -16
package/dist/viem/Transport.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import * as Address from 'ox/Address';
|
|
2
|
-
import * as Hash from 'ox/Hash';
|
|
3
|
-
import * as Hex from 'ox/Hex';
|
|
4
|
-
import * as Provider from 'ox/Provider';
|
|
5
|
-
import * as RpcRequest from 'ox/RpcRequest';
|
|
6
|
-
import { createClient, createTransport } from 'viem';
|
|
7
|
-
import { getTransactionReceipt, sendTransaction, sendTransactionSync, } from 'viem/actions';
|
|
8
|
-
import * as Transaction from './Transaction.js';
|
|
9
|
-
/**
|
|
10
|
-
* Creates a fee payer transport that routes requests between
|
|
11
|
-
* the default transport or the fee payer transport.
|
|
12
|
-
*
|
|
13
|
-
* The policy parameter controls how the fee payer handles transactions:
|
|
14
|
-
* - `'sign-only'`: Fee payer co-signs the transaction and returns it to the client transport, which then broadcasts it via the default transport
|
|
15
|
-
* - `'sign-and-broadcast'`: Fee payer co-signs and broadcasts the transaction directly
|
|
16
|
-
*
|
|
17
|
-
* @param defaultTransport - The default transport to use.
|
|
18
|
-
* @param feePayerTransport - The fee payer transport to use.
|
|
19
|
-
* @param parameters - Configuration parameters.
|
|
20
|
-
* @returns A relay transport.
|
|
21
|
-
*/
|
|
22
|
-
export function withFeePayer(defaultTransport, relayTransport, parameters) {
|
|
23
|
-
const { policy = 'sign-only' } = parameters ?? {};
|
|
24
|
-
return (config) => {
|
|
25
|
-
const transport_default = defaultTransport(config);
|
|
26
|
-
const transport_relay = relayTransport(config);
|
|
27
|
-
return createTransport({
|
|
28
|
-
key: withFeePayer.type,
|
|
29
|
-
name: 'Relay Proxy',
|
|
30
|
-
async request({ method, params }, options) {
|
|
31
|
-
if (method === 'eth_sendRawTransactionSync' ||
|
|
32
|
-
method === 'eth_sendRawTransaction') {
|
|
33
|
-
const serialized = params[0];
|
|
34
|
-
const transaction = Transaction.deserialize(serialized);
|
|
35
|
-
// If the transaction is intended to be sponsored, forward it to the relay.
|
|
36
|
-
if (transaction.feePayerSignature === null) {
|
|
37
|
-
// For 'sign-and-broadcast', relay signs and broadcasts
|
|
38
|
-
if (policy === 'sign-and-broadcast')
|
|
39
|
-
return transport_relay.request({ method, params }, options);
|
|
40
|
-
// For 'sign-only', request signature from relay using eth_signRawTransaction
|
|
41
|
-
{
|
|
42
|
-
// Request signature from relay using eth_signRawTransaction
|
|
43
|
-
const signedTransaction = await transport_relay.request({
|
|
44
|
-
method: 'eth_signRawTransaction',
|
|
45
|
-
params: [serialized],
|
|
46
|
-
}, options);
|
|
47
|
-
// Broadcast the signed transaction via the default transport
|
|
48
|
-
return transport_default.request({ method, params: [signedTransaction] }, options);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return transport_default.request({ method, params }, options);
|
|
53
|
-
},
|
|
54
|
-
type: withFeePayer.type,
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Creates a transport that instruments a compatibility layer for
|
|
60
|
-
* `wallet_` RPC actions (`sendCalls`, `getCallsStatus`, etc).
|
|
61
|
-
*
|
|
62
|
-
* @param transport - Transport to wrap.
|
|
63
|
-
* @returns Transport.
|
|
64
|
-
*/
|
|
65
|
-
export function walletNamespaceCompat(transport) {
|
|
66
|
-
const sendCallsMagic = Hash.keccak256(Hex.fromString('TEMPO_5792'));
|
|
67
|
-
return (options) => {
|
|
68
|
-
const t = transport(options);
|
|
69
|
-
const account = options.account;
|
|
70
|
-
const chain = options.chain;
|
|
71
|
-
return {
|
|
72
|
-
...t,
|
|
73
|
-
async request(args) {
|
|
74
|
-
const request = RpcRequest.from(args);
|
|
75
|
-
const client = createClient({
|
|
76
|
-
account,
|
|
77
|
-
chain,
|
|
78
|
-
transport,
|
|
79
|
-
});
|
|
80
|
-
if (request.method === 'wallet_sendCalls') {
|
|
81
|
-
const params = request.params[0] ?? {};
|
|
82
|
-
const { capabilities, chainId, from } = params;
|
|
83
|
-
const { sync } = capabilities ?? {};
|
|
84
|
-
if (!account)
|
|
85
|
-
throw new Provider.DisconnectedError();
|
|
86
|
-
if (!chainId)
|
|
87
|
-
throw new Provider.UnsupportedChainIdError();
|
|
88
|
-
if (Number(chainId) !== client.chain.id)
|
|
89
|
-
throw new Provider.UnsupportedChainIdError();
|
|
90
|
-
if (from && !Address.isEqual(from, account.address))
|
|
91
|
-
throw new Provider.DisconnectedError();
|
|
92
|
-
const calls = (params.calls ?? []).map((call) => ({
|
|
93
|
-
to: call.to,
|
|
94
|
-
value: call.value ? BigInt(call.value) : undefined,
|
|
95
|
-
data: call.data,
|
|
96
|
-
}));
|
|
97
|
-
const hash = await (async () => {
|
|
98
|
-
if (!sync)
|
|
99
|
-
return sendTransaction(client, {
|
|
100
|
-
account,
|
|
101
|
-
calls,
|
|
102
|
-
});
|
|
103
|
-
const { transactionHash } = await sendTransactionSync(client, {
|
|
104
|
-
account,
|
|
105
|
-
calls,
|
|
106
|
-
});
|
|
107
|
-
return transactionHash;
|
|
108
|
-
})();
|
|
109
|
-
const id = Hex.concat(hash, Hex.padLeft(chainId, 32), sendCallsMagic);
|
|
110
|
-
return {
|
|
111
|
-
capabilities: { sync },
|
|
112
|
-
id,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
if (request.method === 'wallet_getCallsStatus') {
|
|
116
|
-
const [id] = request.params ?? [];
|
|
117
|
-
if (!id)
|
|
118
|
-
throw new Error('`id` not found');
|
|
119
|
-
if (!id.endsWith(sendCallsMagic.slice(2)))
|
|
120
|
-
throw new Error('`id` not supported');
|
|
121
|
-
Hex.assert(id);
|
|
122
|
-
const hash = Hex.slice(id, 0, 32);
|
|
123
|
-
const chainId = Hex.slice(id, 32, 64);
|
|
124
|
-
const receipt = await getTransactionReceipt(client, { hash });
|
|
125
|
-
return {
|
|
126
|
-
atomic: true,
|
|
127
|
-
chainId: Number(chainId),
|
|
128
|
-
receipts: [receipt],
|
|
129
|
-
status: receipt.status === 'success' ? 200 : 500,
|
|
130
|
-
version: '2.0.0',
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
return t.request(args);
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=Transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Transport.js","sourceRoot":"","sources":["../../src/viem/Transport.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OAAO;qBACjB,CAAA;gBACH,CAAC;gBAED,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;YACxB,CAAC;SACO,CAAA;IACZ,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import * as Bytes from 'ox/Bytes';
|
|
2
|
-
import type * as Hex from 'ox/Hex';
|
|
3
|
-
import * as WebAuthnP256 from 'ox/WebAuthnP256';
|
|
4
|
-
export type P256Credential = {
|
|
5
|
-
id: WebAuthnP256.P256Credential['id'];
|
|
6
|
-
publicKey: Hex.Hex;
|
|
7
|
-
raw: WebAuthnP256.P256Credential['raw'];
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Creates a WebAuthn credential (ie. a passkey).
|
|
11
|
-
*
|
|
12
|
-
* This function returns the credential object, which includes the public key.
|
|
13
|
-
* It is recommended to store the public key against the credential in an external store
|
|
14
|
-
* as it is not possible to extract a public key from a credential after it has been created.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* import { WebAuthnP256 } from 'tempo.ts/viem'
|
|
19
|
-
*
|
|
20
|
-
* const credential = await WebAuthnP256.createCredential({ name: 'Example' })
|
|
21
|
-
* // {
|
|
22
|
-
* // id: 'oZ48...',
|
|
23
|
-
* // publicKey: '0x...',
|
|
24
|
-
* // }
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* @param parameters WebAuthnP256 createCredential options.
|
|
28
|
-
* @returns WebAuthn credential.
|
|
29
|
-
*/
|
|
30
|
-
export declare function createCredential(parameters: createCredential.Parameters): Promise<createCredential.ReturnValue>;
|
|
31
|
-
export declare namespace createCredential {
|
|
32
|
-
type Parameters = Omit<WebAuthnP256.createCredential.Options, 'rp' | 'user'> & {
|
|
33
|
-
/**
|
|
34
|
-
* Credential creation function. Useful for environments that do not support
|
|
35
|
-
* the WebAuthn API natively (i.e. React Native or testing environments).
|
|
36
|
-
*
|
|
37
|
-
* @default window.navigator.credentials.create
|
|
38
|
-
*/
|
|
39
|
-
createFn?: WebAuthnP256.createCredential.Options['createFn'] | undefined;
|
|
40
|
-
/** Label. */
|
|
41
|
-
label: string;
|
|
42
|
-
/** Relying Party ID. */
|
|
43
|
-
rpId?: string | undefined;
|
|
44
|
-
/** User ID. */
|
|
45
|
-
userId?: Bytes.Bytes | undefined;
|
|
46
|
-
};
|
|
47
|
-
type ReturnValue = P256Credential;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Gets a WebAuthn credential (ie. a passkey), and optionally signs over a digest/hash.
|
|
51
|
-
*
|
|
52
|
-
* A `getPublicKey` function is required to fetch the public key paired with the credential
|
|
53
|
-
* from an external store. It is not possible to extract a public key from a credential after
|
|
54
|
-
* the credential has been created with `WebAuthnP256.createCredential`.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* import { WebAuthnP256 } from 'tempo.ts/viem'
|
|
59
|
-
*
|
|
60
|
-
* const credential = await WebAuthnP256.getCredential({
|
|
61
|
-
* async getPublicKey(credential) {
|
|
62
|
-
* // Get public key from store
|
|
63
|
-
* return store.getPublicKey(credential.id)
|
|
64
|
-
* }
|
|
65
|
-
* })
|
|
66
|
-
* ```
|
|
67
|
-
*
|
|
68
|
-
* @param parameters WebAuthnP256 getCredential options.
|
|
69
|
-
* @returns WebAuthn credential.
|
|
70
|
-
*/
|
|
71
|
-
export declare function getCredential(parameters: getCredential.Parameters): Promise<getCredential.ReturnValue>;
|
|
72
|
-
export declare namespace getCredential {
|
|
73
|
-
type Parameters = Omit<WebAuthnP256.sign.Options, 'challenge'> & {
|
|
74
|
-
hash?: Hex.Hex | undefined;
|
|
75
|
-
getPublicKey: (credential: WebAuthnP256.P256Credential['raw']) => Promise<Hex.Hex>;
|
|
76
|
-
};
|
|
77
|
-
type ReturnValue = WebAuthnP256.sign.ReturnType & {
|
|
78
|
-
id: string;
|
|
79
|
-
publicKey: Hex.Hex;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,EAAE,aAAa,CAAC,UAAU,GACnC,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,CAapC;AAED,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACrC,KAAY,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG;QACtE,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,SAAS,CAAA;QAC1B,YAAY,EAAE,CACZ,UAAU,EAAE,YAAY,CAAC,cAAc,CAAC,KAAK,CAAC,KAC3C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;KACtB,CAAA;IAED,KAAY,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,UAAU,GAAG;QACvD,EAAE,EAAE,MAAM,CAAA;QACV,SAAS,EAAE,GAAG,CAAC,GAAG,CAAA;KACnB,CAAA;CACF"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import * as Bytes from 'ox/Bytes';
|
|
2
|
-
import * as PublicKey from 'ox/PublicKey';
|
|
3
|
-
import * as WebAuthnP256 from 'ox/WebAuthnP256';
|
|
4
|
-
/**
|
|
5
|
-
* Creates a WebAuthn credential (ie. a passkey).
|
|
6
|
-
*
|
|
7
|
-
* This function returns the credential object, which includes the public key.
|
|
8
|
-
* It is recommended to store the public key against the credential in an external store
|
|
9
|
-
* as it is not possible to extract a public key from a credential after it has been created.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* import { WebAuthnP256 } from 'tempo.ts/viem'
|
|
14
|
-
*
|
|
15
|
-
* const credential = await WebAuthnP256.createCredential({ name: 'Example' })
|
|
16
|
-
* // {
|
|
17
|
-
* // id: 'oZ48...',
|
|
18
|
-
* // publicKey: '0x...',
|
|
19
|
-
* // }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @param parameters WebAuthnP256 createCredential options.
|
|
23
|
-
* @returns WebAuthn credential.
|
|
24
|
-
*/
|
|
25
|
-
export async function createCredential(parameters) {
|
|
26
|
-
const { createFn, label, rpId, userId } = parameters;
|
|
27
|
-
const credential = await WebAuthnP256.createCredential({
|
|
28
|
-
...parameters,
|
|
29
|
-
authenticatorSelection: {
|
|
30
|
-
...parameters.authenticatorSelection,
|
|
31
|
-
requireResidentKey: true,
|
|
32
|
-
residentKey: 'required',
|
|
33
|
-
userVerification: 'required',
|
|
34
|
-
},
|
|
35
|
-
createFn,
|
|
36
|
-
extensions: {
|
|
37
|
-
...parameters.extensions,
|
|
38
|
-
credProps: true,
|
|
39
|
-
},
|
|
40
|
-
rp: rpId
|
|
41
|
-
? {
|
|
42
|
-
id: rpId,
|
|
43
|
-
name: rpId,
|
|
44
|
-
}
|
|
45
|
-
: undefined,
|
|
46
|
-
name: undefined,
|
|
47
|
-
user: {
|
|
48
|
-
displayName: label,
|
|
49
|
-
id: new Uint8Array(userId ?? Bytes.fromString(label)),
|
|
50
|
-
name: label,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
id: credential.id,
|
|
55
|
-
publicKey: PublicKey.toHex(credential.publicKey, {
|
|
56
|
-
includePrefix: false,
|
|
57
|
-
}),
|
|
58
|
-
raw: credential.raw,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Gets a WebAuthn credential (ie. a passkey), and optionally signs over a digest/hash.
|
|
63
|
-
*
|
|
64
|
-
* A `getPublicKey` function is required to fetch the public key paired with the credential
|
|
65
|
-
* from an external store. It is not possible to extract a public key from a credential after
|
|
66
|
-
* the credential has been created with `WebAuthnP256.createCredential`.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```ts
|
|
70
|
-
* import { WebAuthnP256 } from 'tempo.ts/viem'
|
|
71
|
-
*
|
|
72
|
-
* const credential = await WebAuthnP256.getCredential({
|
|
73
|
-
* async getPublicKey(credential) {
|
|
74
|
-
* // Get public key from store
|
|
75
|
-
* return store.getPublicKey(credential.id)
|
|
76
|
-
* }
|
|
77
|
-
* })
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* @param parameters WebAuthnP256 getCredential options.
|
|
81
|
-
* @returns WebAuthn credential.
|
|
82
|
-
*/
|
|
83
|
-
export async function getCredential(parameters) {
|
|
84
|
-
const { metadata, raw, signature } = await WebAuthnP256.sign({
|
|
85
|
-
...parameters,
|
|
86
|
-
challenge: parameters.hash ?? '0x',
|
|
87
|
-
});
|
|
88
|
-
const publicKey = await parameters.getPublicKey(raw);
|
|
89
|
-
return {
|
|
90
|
-
id: raw.id,
|
|
91
|
-
metadata,
|
|
92
|
-
publicKey,
|
|
93
|
-
raw,
|
|
94
|
-
signature,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=WebAuthnP256.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebAuthnP256.js","sourceRoot":"","sources":["../../src/viem/WebAuthnP256.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAEjC,OAAO,KAAK,SAAS,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAA;AAQ/C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,UAAuC;IAEvC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAAA;IACpD,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,gBAAgB,CAAC;QACrD,GAAG,UAAU;QACb,sBAAsB,EAAE;YACtB,GAAG,UAAU,CAAC,sBAAsB;YACpC,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,UAAU;YACvB,gBAAgB,EAAE,UAAU;SAC7B;QACD,QAAQ;QACR,UAAU,EAAE;YACV,GAAG,UAAU,CAAC,UAAU;YACxB,SAAS,EAAE,IAAI;SAChB;QACD,EAAE,EAAE,IAAI;YACN,CAAC,CAAC;gBACE,EAAE,EAAE,IAAI;gBACR,IAAI,EAAE,IAAI;aACX;YACH,CAAC,CAAC,SAAS;QACb,IAAI,EAAE,SAAkB;QACxB,IAAI,EAAE;YACJ,WAAW,EAAE,KAAK;YAClB,EAAE,EAAE,IAAI,UAAU,CAAC,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACrD,IAAI,EAAE,KAAK;SACZ;KACF,CAAC,CAAA;IACF,OAAO;QACL,EAAE,EAAE,UAAU,CAAC,EAAE;QACjB,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE;YAC/C,aAAa,EAAE,KAAK;SACrB,CAAC;QACF,GAAG,EAAE,UAAU,CAAC,GAAG;KACpB,CAAA;AACH,CAAC;AAyBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,UAAoC;IAEpC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC;QAC3D,GAAG,UAAU;QACb,SAAS,EAAE,UAAU,CAAC,IAAI,IAAI,IAAI;KACnC,CAAC,CAAA;IACF,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACpD,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,QAAQ;QACR,SAAS;QACT,GAAG;QACH,SAAS;KACV,CAAA;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebCryptoP256.d.ts","sourceRoot":"","sources":["../../src/viem/WebCryptoP256.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebCryptoP256.js","sourceRoot":"","sources":["../../src/viem/WebCryptoP256.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { TokenId } from 'ox/tempo';
|
|
2
|
-
import type { Account, Address, Chain, ReadContractParameters as viem_ReadContractParameters, WriteContractSyncParameters as viem_WriteContractSyncParameters } from 'viem';
|
|
3
|
-
import type { IsUndefined, MaybeRequired, UnionPick } from '../../internal/types.js';
|
|
4
|
-
import type { TransactionRequestTempo } from '../Transaction.js';
|
|
5
|
-
export type GetAccountParameter<account extends Account | undefined = Account | undefined, accountOverride extends Account | Address | undefined = Account | Address, required extends boolean = true, nullish extends boolean = false> = MaybeRequired<{
|
|
6
|
-
account?: accountOverride | Account | Address | (nullish extends true ? null : never) | undefined;
|
|
7
|
-
}, IsUndefined<account> extends true ? required extends true ? true : false : false>;
|
|
8
|
-
export type GetFeeTokenParameter<chain extends Chain | undefined = Chain | undefined> = chain extends {
|
|
9
|
-
feeToken: infer feeToken;
|
|
10
|
-
} ? IsUndefined<feeToken> extends true ? {
|
|
11
|
-
feeToken: TokenId.TokenIdOrAddress | null;
|
|
12
|
-
} : {
|
|
13
|
-
feeToken?: TokenId.TokenIdOrAddress | null | undefined;
|
|
14
|
-
} : {
|
|
15
|
-
feeToken: TokenId.TokenIdOrAddress | null;
|
|
16
|
-
};
|
|
17
|
-
export type ReadParameters = Pick<viem_ReadContractParameters<never, never, never>, 'account' | 'blockNumber' | 'blockOverrides' | 'blockTag' | 'stateOverride'>;
|
|
18
|
-
export type TokenIdOrAddress = bigint | Address;
|
|
19
|
-
export type WriteParameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = UnionPick<viem_WriteContractSyncParameters<never, never, never, chain, account>, 'account' | 'chain' | 'gas' | 'maxFeePerGas' | 'maxPriorityFeePerGas' | 'nonce' | 'throwOnReceiptRevert'> & GetFeeTokenParameter<chain> & UnionPick<TransactionRequestTempo, 'feePayer' | 'nonceKey' | 'validAfter' | 'validBefore'>;
|
|
20
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/viem/internal/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,sBAAsB,IAAI,2BAA2B,EACrD,2BAA2B,IAAI,gCAAgC,EAChE,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,SAAS,EACV,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAEhE,MAAM,MAAM,mBAAmB,CAC7B,OAAO,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EACzD,eAAe,SAAS,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,EACzE,QAAQ,SAAS,OAAO,GAAG,IAAI,EAC/B,OAAO,SAAS,OAAO,GAAG,KAAK,IAC7B,aAAa,CACf;IACE,OAAO,CAAC,EACJ,eAAe,GACf,OAAO,GACP,OAAO,GACP,CAAC,OAAO,SAAS,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC,GACrC,SAAS,CAAA;CACd,EACD,WAAW,CAAC,OAAO,CAAC,SAAS,IAAI,GAC7B,QAAQ,SAAS,IAAI,GACnB,IAAI,GACJ,KAAK,GACP,KAAK,CACV,CAAA;AAED,MAAM,MAAM,oBAAoB,CAC9B,KAAK,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IACjD,KAAK,SAAS;IAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;CAAE,GAC1C,WAAW,CAAC,QAAQ,CAAC,SAAS,IAAI,GAChC;IAAE,QAAQ,EAAE,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAA;CAAE,GAC7C;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,gBAAgB,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,GAC5D;IAAE,QAAQ,EAAE,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAA;CAAE,CAAA;AAEjD,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,2BAA2B,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAChD,SAAS,GAAG,aAAa,GAAG,gBAAgB,GAAG,UAAU,GAAG,eAAe,CAC5E,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,CAAA;AAE/C,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACnD,OAAO,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACvD,SAAS,CACX,gCAAgC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EACnE,SAAS,GACT,OAAO,GACP,KAAK,GACL,cAAc,GACd,sBAAsB,GACtB,OAAO,GACP,sBAAsB,CACzB,GACC,oBAAoB,CAAC,KAAK,CAAC,GAC3B,SAAS,CACP,uBAAuB,EACvB,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CACvD,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/viem/internal/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type Abi, type AbiStateMutability, type Address, type ContractFunctionName, type ContractFunctionParameters, type ExtractAbiItem, type Hex } from 'viem';
|
|
2
|
-
export declare function defineCall<const abi extends Abi, const functionName extends ContractFunctionName<abi, AbiStateMutability>, call extends ContractFunctionParameters<abi, AbiStateMutability, functionName>>(call: call | ContractFunctionParameters<abi, AbiStateMutability, functionName>): ContractFunctionParameters<[
|
|
3
|
-
ExtractAbiItem<abi, functionName>
|
|
4
|
-
], AbiStateMutability, functionName> & {
|
|
5
|
-
data: Hex;
|
|
6
|
-
to: Address;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Normalizes a value into a structured-clone compatible format.
|
|
10
|
-
*
|
|
11
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/structuredClone
|
|
12
|
-
*/
|
|
13
|
-
export declare function normalizeValue<type>(value: type): type;
|
|
14
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/viem/internal/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,cAAc,EAEnB,KAAK,GAAG,EACT,MAAM,MAAM,CAAA;AAEb,wBAAgB,UAAU,CACxB,KAAK,CAAC,GAAG,SAAS,GAAG,EACrB,KAAK,CAAC,YAAY,SAAS,oBAAoB,CAAC,GAAG,EAAE,kBAAkB,CAAC,EACxE,IAAI,SAAS,0BAA0B,CACrC,GAAG,EACH,kBAAkB,EAClB,YAAY,CACb,EAED,IAAI,EACA,IAAI,GACJ,0BAA0B,CAAC,GAAG,EAAE,kBAAkB,EAAE,YAAY,CAAC,GACpE,0BAA0B,CAC3B;IAAC,cAAc,CAAC,GAAG,EAAE,YAAY,CAAC;CAAC,EACnC,kBAAkB,EAClB,YAAY,CACb,GAAG;IACF,IAAI,EAAE,GAAG,CAAA;IACT,EAAE,EAAE,OAAO,CAAA;CACZ,CAMA;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CActD"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { encodeFunctionData, } from 'viem';
|
|
2
|
-
export function defineCall(call) {
|
|
3
|
-
return {
|
|
4
|
-
...call,
|
|
5
|
-
data: encodeFunctionData(call),
|
|
6
|
-
to: call.address,
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Normalizes a value into a structured-clone compatible format.
|
|
11
|
-
*
|
|
12
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/structuredClone
|
|
13
|
-
*/
|
|
14
|
-
export function normalizeValue(value) {
|
|
15
|
-
if (Array.isArray(value))
|
|
16
|
-
return value.map(normalizeValue);
|
|
17
|
-
if (typeof value === 'function')
|
|
18
|
-
return undefined;
|
|
19
|
-
if (typeof value !== 'object' || value === null)
|
|
20
|
-
return value;
|
|
21
|
-
if (Object.getPrototypeOf(value) !== Object.prototype)
|
|
22
|
-
try {
|
|
23
|
-
return structuredClone(value);
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
const normalized = {};
|
|
29
|
-
for (const [k, v] of Object.entries(value))
|
|
30
|
-
normalized[k] = normalizeValue(v);
|
|
31
|
-
return normalized;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/viem/internal/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,kBAAkB,GAEnB,MAAM,MAAM,CAAA;AAEb,MAAM,UAAU,UAAU,CASxB,IAEqE;IASrE,OAAO;QACL,GAAI,IAAY;QAChB,IAAI,EAAE,kBAAkB,CAAC,IAAa,CAAC;QACvC,EAAE,EAAE,IAAI,CAAC,OAAO;KACR,CAAA;AACZ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAO,KAAW;IAC9C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,cAAc,CAAU,CAAA;IACnE,IAAI,OAAO,KAAK,KAAK,UAAU;QAAE,OAAO,SAAkB,CAAA;IAC1D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IAC7D,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,SAAS;QACnD,IAAI,CAAC;YACH,OAAO,eAAe,CAAC,KAAK,CAAC,CAAA;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAkB,CAAA;QAC3B,CAAC;IAEH,MAAM,UAAU,GAA4B,EAAE,CAAA;IAC9C,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,UAAU,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;IAC7E,OAAO,UAAmB,CAAA;AAC5B,CAAC"}
|
package/src/chains.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import * as Chain from './viem/Chain.js'
|
|
2
|
-
|
|
3
|
-
export const tempoDevnet = /*#__PURE__*/ Chain.define({
|
|
4
|
-
id: 1337,
|
|
5
|
-
name: 'Tempo Devnet',
|
|
6
|
-
nativeCurrency: {
|
|
7
|
-
name: 'USD',
|
|
8
|
-
symbol: 'USD',
|
|
9
|
-
decimals: 6,
|
|
10
|
-
},
|
|
11
|
-
rpcUrls: {
|
|
12
|
-
default: {
|
|
13
|
-
http: ['https://rpc.devnet.tempo.xyz'],
|
|
14
|
-
webSocket: ['wss://rpc.devnet.tempo.xyz'],
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
export const tempoLocal = /*#__PURE__*/ Chain.define({
|
|
20
|
-
id: 1337,
|
|
21
|
-
name: 'Tempo',
|
|
22
|
-
nativeCurrency: {
|
|
23
|
-
name: 'USD',
|
|
24
|
-
symbol: 'USD',
|
|
25
|
-
decimals: 6,
|
|
26
|
-
},
|
|
27
|
-
rpcUrls: {
|
|
28
|
-
default: { http: ['http://localhost:8545'] },
|
|
29
|
-
},
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
export const tempoTestnet = /*#__PURE__*/ Chain.define({
|
|
33
|
-
id: 42429,
|
|
34
|
-
blockExplorers: {
|
|
35
|
-
default: {
|
|
36
|
-
name: 'Tempo Explorer',
|
|
37
|
-
url: 'https://explore.tempo.xyz',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
name: 'Tempo Testnet',
|
|
41
|
-
nativeCurrency: {
|
|
42
|
-
name: 'USD',
|
|
43
|
-
symbol: 'USD',
|
|
44
|
-
decimals: 6,
|
|
45
|
-
},
|
|
46
|
-
rpcUrls: {
|
|
47
|
-
default: {
|
|
48
|
-
http: ['https://rpc.testnet.tempo.xyz'],
|
|
49
|
-
webSocket: ['wss://rpc.testnet.tempo.xyz'],
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
export const tempo = /*#__PURE__*/ tempoTestnet
|