@settlemint/sdk-viem 2.3.2-pre186542e → 2.3.2-prede7bc05
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/README.md +99 -26
- package/dist/browser/viem.d.ts +14190 -0
- package/dist/browser/viem.js +10506 -0
- package/dist/browser/viem.js.map +1 -0
- package/dist/viem.cjs +10530 -1
- package/dist/viem.cjs.map +1 -1
- package/dist/viem.d.cts +14003 -13909
- package/dist/viem.d.ts +14003 -13909
- package/dist/viem.js +10507 -0
- package/dist/viem.js.map +1 -0
- package/package.json +6 -6
- package/dist/viem.mjs +0 -2
- package/dist/viem.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
- [About](#about)
|
|
30
30
|
- [API Reference](#api-reference)
|
|
31
31
|
- [Functions](#functions)
|
|
32
|
+
- [getChainId()](#getchainid)
|
|
32
33
|
- [getPublicClient()](#getpublicclient)
|
|
33
34
|
- [getWalletClient()](#getwalletclient)
|
|
34
35
|
- [Enumerations](#enumerations)
|
|
35
36
|
- [OTPAlgorithm](#otpalgorithm)
|
|
36
37
|
- [WalletVerificationType](#walletverificationtype)
|
|
37
38
|
- [Interfaces](#interfaces)
|
|
38
|
-
- [ClientOptions](#clientoptions)
|
|
39
39
|
- [CreateWalletParameters](#createwalletparameters)
|
|
40
40
|
- [CreateWalletResponse](#createwalletresponse)
|
|
41
41
|
- [CreateWalletVerificationChallengesParameters](#createwalletverificationchallengesparameters)
|
|
@@ -55,10 +55,15 @@
|
|
|
55
55
|
- [WalletVerificationOptions](#walletverificationoptions)
|
|
56
56
|
- [Type Aliases](#type-aliases)
|
|
57
57
|
- [AddressOrObject](#addressorobject)
|
|
58
|
+
- [ClientOptions](#clientoptions)
|
|
58
59
|
- [CreateWalletVerificationChallengesResponse](#createwalletverificationchallengesresponse)
|
|
60
|
+
- [GetChainIdOptions](#getchainidoptions)
|
|
59
61
|
- [GetWalletVerificationsResponse](#getwalletverificationsresponse)
|
|
60
62
|
- [VerifyWalletVerificationChallengeResponse](#verifywalletverificationchallengeresponse)
|
|
61
63
|
- [WalletVerificationInfo](#walletverificationinfo)
|
|
64
|
+
- [Variables](#variables)
|
|
65
|
+
- [ClientOptionsSchema](#clientoptionsschema)
|
|
66
|
+
- [GetChainIdOptionsSchema](#getchainidoptionsschema)
|
|
62
67
|
- [Contributing](#contributing)
|
|
63
68
|
- [License](#license)
|
|
64
69
|
|
|
@@ -70,11 +75,45 @@ The SettleMint Viem SDK provides a lightweight wrapper that automatically config
|
|
|
70
75
|
|
|
71
76
|
### Functions
|
|
72
77
|
|
|
78
|
+
#### getChainId()
|
|
79
|
+
|
|
80
|
+
> **getChainId**(`options`): `Promise`\<`number`\>
|
|
81
|
+
|
|
82
|
+
Defined in: [sdk/viem/src/viem.ts:217](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L217)
|
|
83
|
+
|
|
84
|
+
Get the chain id of a blockchain network.
|
|
85
|
+
|
|
86
|
+
##### Parameters
|
|
87
|
+
|
|
88
|
+
| Parameter | Type | Description |
|
|
89
|
+
| ------ | ------ | ------ |
|
|
90
|
+
| `options` | [`GetChainIdOptions`](#getchainidoptions) | The options for the public client. |
|
|
91
|
+
|
|
92
|
+
##### Returns
|
|
93
|
+
|
|
94
|
+
`Promise`\<`number`\>
|
|
95
|
+
|
|
96
|
+
The chain id.
|
|
97
|
+
|
|
98
|
+
##### Example
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import { getChainId } from '@settlemint/sdk-viem';
|
|
102
|
+
|
|
103
|
+
const chainId = await getChainId({
|
|
104
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
|
105
|
+
rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,
|
|
106
|
+
});
|
|
107
|
+
console.log(chainId);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
***
|
|
111
|
+
|
|
73
112
|
#### getPublicClient()
|
|
74
113
|
|
|
75
114
|
> **getPublicClient**(`options`): `object`
|
|
76
115
|
|
|
77
|
-
Defined in: [sdk/viem/src/viem.ts:
|
|
116
|
+
Defined in: [sdk/viem/src/viem.ts:75](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L75)
|
|
78
117
|
|
|
79
118
|
Get a public client. Use this if you need to read from the blockchain.
|
|
80
119
|
|
|
@@ -96,7 +135,7 @@ The public client. see [https://viem.sh/docs/clients/public](https://viem.sh/doc
|
|
|
96
135
|
import { getPublicClient } from '@settlemint/sdk-viem';
|
|
97
136
|
|
|
98
137
|
const publicClient = getPublicClient({
|
|
99
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN
|
|
138
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
|
100
139
|
chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,
|
|
101
140
|
chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
|
|
102
141
|
rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,
|
|
@@ -113,7 +152,7 @@ console.log(block);
|
|
|
113
152
|
|
|
114
153
|
> **getWalletClient**(`options`): (`verificationOptions?`) => `Client`\<`HttpTransport`\<`undefined` \| `RpcSchema`, `boolean`\>, `Chain`, `undefined`, `WalletRpcSchema`, `object` & `object` & `object` & `object` & `object` & `object` & `object` & `WalletActions`\<`Chain`, `undefined`\>\>
|
|
115
154
|
|
|
116
|
-
Defined in: [sdk/viem/src/viem.ts:
|
|
155
|
+
Defined in: [sdk/viem/src/viem.ts:143](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L143)
|
|
117
156
|
|
|
118
157
|
Get a wallet client. Use this if you need to write to the blockchain.
|
|
119
158
|
|
|
@@ -146,7 +185,7 @@ import { getWalletClient } from '@settlemint/sdk-viem';
|
|
|
146
185
|
import { parseAbi } from "viem";
|
|
147
186
|
|
|
148
187
|
const walletClient = getWalletClient({
|
|
149
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN
|
|
188
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
|
150
189
|
chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,
|
|
151
190
|
chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
|
|
152
191
|
rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,
|
|
@@ -209,24 +248,6 @@ Used to identify different verification mechanisms when creating or managing wal
|
|
|
209
248
|
|
|
210
249
|
### Interfaces
|
|
211
250
|
|
|
212
|
-
#### ClientOptions
|
|
213
|
-
|
|
214
|
-
Defined in: [sdk/viem/src/viem.ts:21](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L21)
|
|
215
|
-
|
|
216
|
-
The options for the viem client.
|
|
217
|
-
|
|
218
|
-
##### Properties
|
|
219
|
-
|
|
220
|
-
| Property | Type | Description | Defined in |
|
|
221
|
-
| ------ | ------ | ------ | ------ |
|
|
222
|
-
| <a id="accesstoken"></a> `accessToken` | `string` | The access token | [sdk/viem/src/viem.ts:25](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L25) |
|
|
223
|
-
| <a id="chainid"></a> `chainId` | `string` | The chain id | [sdk/viem/src/viem.ts:29](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L29) |
|
|
224
|
-
| <a id="chainname"></a> `chainName` | `string` | The chain name | [sdk/viem/src/viem.ts:33](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L33) |
|
|
225
|
-
| <a id="httptransportconfig"></a> `httpTransportConfig?` | `HttpTransportConfig` | The http transport config | [sdk/viem/src/viem.ts:41](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L41) |
|
|
226
|
-
| <a id="rpcurl"></a> `rpcUrl` | `string` | The json rpc url | [sdk/viem/src/viem.ts:37](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L37) |
|
|
227
|
-
|
|
228
|
-
***
|
|
229
|
-
|
|
230
251
|
#### CreateWalletParameters
|
|
231
252
|
|
|
232
253
|
Defined in: [sdk/viem/src/custom-actions/create-wallet.action.ts:14](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/custom-actions/create-wallet.action.ts#L14)
|
|
@@ -488,7 +509,7 @@ Represents a wallet verification challenge.
|
|
|
488
509
|
|
|
489
510
|
#### WalletVerificationOptions
|
|
490
511
|
|
|
491
|
-
Defined in: [sdk/viem/src/viem.ts:
|
|
512
|
+
Defined in: [sdk/viem/src/viem.ts:101](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L101)
|
|
492
513
|
|
|
493
514
|
The options for the wallet client.
|
|
494
515
|
|
|
@@ -496,8 +517,8 @@ The options for the wallet client.
|
|
|
496
517
|
|
|
497
518
|
| Property | Type | Description | Defined in |
|
|
498
519
|
| ------ | ------ | ------ | ------ |
|
|
499
|
-
| <a id="challengeresponse-1"></a> `challengeResponse` | `string` | The challenge response (used for HD wallets) | [sdk/viem/src/viem.ts:
|
|
500
|
-
| <a id="verificationid-1"></a> `verificationId?` | `string` | The verification id (used for HD wallets), if not provided, the challenge response will be validated against all active verifications. | [sdk/viem/src/viem.ts:
|
|
520
|
+
| <a id="challengeresponse-1"></a> `challengeResponse` | `string` | The challenge response (used for HD wallets) | [sdk/viem/src/viem.ts:109](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L109) |
|
|
521
|
+
| <a id="verificationid-1"></a> `verificationId?` | `string` | The verification id (used for HD wallets), if not provided, the challenge response will be validated against all active verifications. | [sdk/viem/src/viem.ts:105](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L105) |
|
|
501
522
|
|
|
502
523
|
### Type Aliases
|
|
503
524
|
|
|
@@ -511,6 +532,22 @@ Represents either a wallet address string or an object containing wallet address
|
|
|
511
532
|
|
|
512
533
|
***
|
|
513
534
|
|
|
535
|
+
#### ClientOptions
|
|
536
|
+
|
|
537
|
+
> **ClientOptions** = `Omit`\<`z.infer`\<*typeof* [`ClientOptionsSchema`](#clientoptionsschema)\>, `"httpTransportConfig"`\> & `object`
|
|
538
|
+
|
|
539
|
+
Defined in: [sdk/viem/src/viem.ts:51](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L51)
|
|
540
|
+
|
|
541
|
+
Type representing the validated client options.
|
|
542
|
+
|
|
543
|
+
##### Type declaration
|
|
544
|
+
|
|
545
|
+
| Name | Type | Defined in |
|
|
546
|
+
| ------ | ------ | ------ |
|
|
547
|
+
| `httpTransportConfig?` | `HttpTransportConfig` | [sdk/viem/src/viem.ts:52](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L52) |
|
|
548
|
+
|
|
549
|
+
***
|
|
550
|
+
|
|
514
551
|
#### CreateWalletVerificationChallengesResponse
|
|
515
552
|
|
|
516
553
|
> **CreateWalletVerificationChallengesResponse** = [`WalletVerificationChallenge`](#walletverificationchallenge)[]
|
|
@@ -521,6 +558,22 @@ Response from creating wallet verification challenges.
|
|
|
521
558
|
|
|
522
559
|
***
|
|
523
560
|
|
|
561
|
+
#### GetChainIdOptions
|
|
562
|
+
|
|
563
|
+
> **GetChainIdOptions** = `Omit`\<`z.infer`\<*typeof* [`GetChainIdOptionsSchema`](#getchainidoptionsschema)\>, `"httpTransportConfig"`\> & `object`
|
|
564
|
+
|
|
565
|
+
Defined in: [sdk/viem/src/viem.ts:198](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L198)
|
|
566
|
+
|
|
567
|
+
Type representing the validated get chain id options.
|
|
568
|
+
|
|
569
|
+
##### Type declaration
|
|
570
|
+
|
|
571
|
+
| Name | Type | Defined in |
|
|
572
|
+
| ------ | ------ | ------ |
|
|
573
|
+
| `httpTransportConfig?` | `HttpTransportConfig` | [sdk/viem/src/viem.ts:199](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L199) |
|
|
574
|
+
|
|
575
|
+
***
|
|
576
|
+
|
|
524
577
|
#### GetWalletVerificationsResponse
|
|
525
578
|
|
|
526
579
|
> **GetWalletVerificationsResponse** = [`WalletVerification`](#walletverification)[]
|
|
@@ -549,6 +602,26 @@ Defined in: [sdk/viem/src/custom-actions/create-wallet-verification.action.ts:51
|
|
|
549
602
|
|
|
550
603
|
Union type of all possible wallet verification information types.
|
|
551
604
|
|
|
605
|
+
### Variables
|
|
606
|
+
|
|
607
|
+
#### ClientOptionsSchema
|
|
608
|
+
|
|
609
|
+
> `const` **ClientOptionsSchema**: `ZodObject`\<\{ `accessToken`: `ZodOptional`\<`ZodString`\>; `chainId`: `ZodString`; `chainName`: `ZodString`; `httpTransportConfig`: `ZodOptional`\<`ZodAny`\>; `rpcUrl`: `ZodUnion`\<readonly \[`ZodString`, `ZodString`\]\>; \}, `$strip`\>
|
|
610
|
+
|
|
611
|
+
Defined in: [sdk/viem/src/viem.ts:25](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L25)
|
|
612
|
+
|
|
613
|
+
Schema for the viem client options.
|
|
614
|
+
|
|
615
|
+
***
|
|
616
|
+
|
|
617
|
+
#### GetChainIdOptionsSchema
|
|
618
|
+
|
|
619
|
+
> `const` **GetChainIdOptionsSchema**: `ZodObject`\<\{ `accessToken`: `ZodOptional`\<`ZodString`\>; `httpTransportConfig`: `ZodOptional`\<`ZodAny`\>; `rpcUrl`: `ZodUnion`\<readonly \[`ZodString`, `ZodString`\]\>; \}, `$strip`\>
|
|
620
|
+
|
|
621
|
+
Defined in: [sdk/viem/src/viem.ts:180](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/viem/src/viem.ts#L180)
|
|
622
|
+
|
|
623
|
+
Schema for the viem client options.
|
|
624
|
+
|
|
552
625
|
## Contributing
|
|
553
626
|
|
|
554
627
|
We welcome contributions from the community! Please check out our [Contributing](https://github.com/settlemint/sdk/blob/main/.github/CONTRIBUTING.md) guide to learn how you can help improve the SettleMint SDK through bug reports, feature requests, documentation updates, or code contributions.
|