@twin.org/wallet-connector-entity-storage 0.0.1-next.10
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/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/cjs/index.cjs +307 -0
- package/dist/esm/index.mjs +303 -0
- package/dist/types/entities/walletAddress.d.ts +17 -0
- package/dist/types/entityStorageFaucetConnector.d.ts +28 -0
- package/dist/types/entityStorageWalletConnector.d.ts +60 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/models/IEntityStorageFaucetConnectorConstructorOptions.d.ts +10 -0
- package/dist/types/models/IEntityStorageWalletConnectorConfig.d.ts +20 -0
- package/dist/types/models/IEntityStorageWalletConnectorConstructorOptions.d.ts +25 -0
- package/dist/types/schema.d.ts +4 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/EntityStorageFaucetConnector.md +85 -0
- package/docs/reference/classes/EntityStorageWalletConnector.md +237 -0
- package/docs/reference/classes/WalletAddress.md +37 -0
- package/docs/reference/functions/initSchema.md +9 -0
- package/docs/reference/index.md +17 -0
- package/docs/reference/interfaces/IEntityStorageFaucetConnectorConstructorOptions.md +17 -0
- package/docs/reference/interfaces/IEntityStorageWalletConnectorConfig.md +45 -0
- package/docs/reference/interfaces/IEntityStorageWalletConnectorConstructorOptions.md +53 -0
- package/locales/en.json +7 -0
- package/package.json +43 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Class: EntityStorageWalletConnector
|
|
2
|
+
|
|
3
|
+
Class for performing wallet operations using in-memory storage.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IWalletConnector`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### new EntityStorageWalletConnector()
|
|
12
|
+
|
|
13
|
+
> **new EntityStorageWalletConnector**(`options`?): [`EntityStorageWalletConnector`](EntityStorageWalletConnector.md)
|
|
14
|
+
|
|
15
|
+
Create a new instance of EntityStorageWalletConnector.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`IEntityStorageWalletConnectorConstructorOptions`](../interfaces/IEntityStorageWalletConnectorConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
The options for the wallet connector.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
[`EntityStorageWalletConnector`](EntityStorageWalletConnector.md)
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
### NAMESPACE
|
|
32
|
+
|
|
33
|
+
> `readonly` `static` **NAMESPACE**: `string` = `"entity-storage"`
|
|
34
|
+
|
|
35
|
+
The namespace supported by the wallet connector.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### CLASS\_NAME
|
|
40
|
+
|
|
41
|
+
> `readonly` **CLASS\_NAME**: `string`
|
|
42
|
+
|
|
43
|
+
Runtime name for the class.
|
|
44
|
+
|
|
45
|
+
#### Implementation of
|
|
46
|
+
|
|
47
|
+
`IWalletConnector.CLASS_NAME`
|
|
48
|
+
|
|
49
|
+
## Methods
|
|
50
|
+
|
|
51
|
+
### create()
|
|
52
|
+
|
|
53
|
+
> **create**(`identity`): `Promise`\<`void`\>
|
|
54
|
+
|
|
55
|
+
Create a new wallet.
|
|
56
|
+
|
|
57
|
+
#### Parameters
|
|
58
|
+
|
|
59
|
+
##### identity
|
|
60
|
+
|
|
61
|
+
`string`
|
|
62
|
+
|
|
63
|
+
The identity of the user to access the vault keys.
|
|
64
|
+
|
|
65
|
+
#### Returns
|
|
66
|
+
|
|
67
|
+
`Promise`\<`void`\>
|
|
68
|
+
|
|
69
|
+
Nothing.
|
|
70
|
+
|
|
71
|
+
#### Implementation of
|
|
72
|
+
|
|
73
|
+
`IWalletConnector.create`
|
|
74
|
+
|
|
75
|
+
***
|
|
76
|
+
|
|
77
|
+
### getAddresses()
|
|
78
|
+
|
|
79
|
+
> **getAddresses**(`identity`, `accountIndex`, `startAddressIndex`, `count`): `Promise`\<`string`[]\>
|
|
80
|
+
|
|
81
|
+
Get the addresses for the requested range.
|
|
82
|
+
|
|
83
|
+
#### Parameters
|
|
84
|
+
|
|
85
|
+
##### identity
|
|
86
|
+
|
|
87
|
+
`string`
|
|
88
|
+
|
|
89
|
+
The identity of the user to access the vault keys.
|
|
90
|
+
|
|
91
|
+
##### accountIndex
|
|
92
|
+
|
|
93
|
+
`number`
|
|
94
|
+
|
|
95
|
+
The account index to get the addresses for.
|
|
96
|
+
|
|
97
|
+
##### startAddressIndex
|
|
98
|
+
|
|
99
|
+
`number`
|
|
100
|
+
|
|
101
|
+
The start index for the addresses.
|
|
102
|
+
|
|
103
|
+
##### count
|
|
104
|
+
|
|
105
|
+
`number`
|
|
106
|
+
|
|
107
|
+
The number of addresses to generate.
|
|
108
|
+
|
|
109
|
+
#### Returns
|
|
110
|
+
|
|
111
|
+
`Promise`\<`string`[]\>
|
|
112
|
+
|
|
113
|
+
The list of addresses.
|
|
114
|
+
|
|
115
|
+
#### Implementation of
|
|
116
|
+
|
|
117
|
+
`IWalletConnector.getAddresses`
|
|
118
|
+
|
|
119
|
+
***
|
|
120
|
+
|
|
121
|
+
### getBalance()
|
|
122
|
+
|
|
123
|
+
> **getBalance**(`identity`, `address`): `Promise`\<`bigint`\>
|
|
124
|
+
|
|
125
|
+
Get the balance for an address in a wallet.
|
|
126
|
+
|
|
127
|
+
#### Parameters
|
|
128
|
+
|
|
129
|
+
##### identity
|
|
130
|
+
|
|
131
|
+
`string`
|
|
132
|
+
|
|
133
|
+
The identity of the user to access the vault keys.
|
|
134
|
+
|
|
135
|
+
##### address
|
|
136
|
+
|
|
137
|
+
`string`
|
|
138
|
+
|
|
139
|
+
The bech32 encoded address.
|
|
140
|
+
|
|
141
|
+
#### Returns
|
|
142
|
+
|
|
143
|
+
`Promise`\<`bigint`\>
|
|
144
|
+
|
|
145
|
+
The balance of the wallet address.
|
|
146
|
+
|
|
147
|
+
#### Implementation of
|
|
148
|
+
|
|
149
|
+
`IWalletConnector.getBalance`
|
|
150
|
+
|
|
151
|
+
***
|
|
152
|
+
|
|
153
|
+
### ensureBalance()
|
|
154
|
+
|
|
155
|
+
> **ensureBalance**(`identity`, `address`, `ensureBalance`, `timeoutInSeconds`?): `Promise`\<`boolean`\>
|
|
156
|
+
|
|
157
|
+
Ensure the balance for an address in a wallet.
|
|
158
|
+
|
|
159
|
+
#### Parameters
|
|
160
|
+
|
|
161
|
+
##### identity
|
|
162
|
+
|
|
163
|
+
`string`
|
|
164
|
+
|
|
165
|
+
The identity of the user to access the vault keys.
|
|
166
|
+
|
|
167
|
+
##### address
|
|
168
|
+
|
|
169
|
+
`string`
|
|
170
|
+
|
|
171
|
+
The bech32 encoded address.
|
|
172
|
+
|
|
173
|
+
##### ensureBalance
|
|
174
|
+
|
|
175
|
+
`bigint`
|
|
176
|
+
|
|
177
|
+
The balance to ensure on the address.
|
|
178
|
+
|
|
179
|
+
##### timeoutInSeconds?
|
|
180
|
+
|
|
181
|
+
`number`
|
|
182
|
+
|
|
183
|
+
The timeout in seconds to wait for the funding to complete.
|
|
184
|
+
|
|
185
|
+
#### Returns
|
|
186
|
+
|
|
187
|
+
`Promise`\<`boolean`\>
|
|
188
|
+
|
|
189
|
+
True if the balance has been ensured.
|
|
190
|
+
|
|
191
|
+
#### Implementation of
|
|
192
|
+
|
|
193
|
+
`IWalletConnector.ensureBalance`
|
|
194
|
+
|
|
195
|
+
***
|
|
196
|
+
|
|
197
|
+
### transfer()
|
|
198
|
+
|
|
199
|
+
> **transfer**(`identity`, `addressSource`, `addressDest`, `amount`): `Promise`\<`undefined` \| `string`\>
|
|
200
|
+
|
|
201
|
+
Transfer funds to an address.
|
|
202
|
+
|
|
203
|
+
#### Parameters
|
|
204
|
+
|
|
205
|
+
##### identity
|
|
206
|
+
|
|
207
|
+
`string`
|
|
208
|
+
|
|
209
|
+
The identity of the user to access the vault keys.
|
|
210
|
+
|
|
211
|
+
##### addressSource
|
|
212
|
+
|
|
213
|
+
`string`
|
|
214
|
+
|
|
215
|
+
The bech32 encoded address to send the funds from.
|
|
216
|
+
|
|
217
|
+
##### addressDest
|
|
218
|
+
|
|
219
|
+
`string`
|
|
220
|
+
|
|
221
|
+
The bech32 encoded address to send the funds to.
|
|
222
|
+
|
|
223
|
+
##### amount
|
|
224
|
+
|
|
225
|
+
`bigint`
|
|
226
|
+
|
|
227
|
+
The amount to transfer.
|
|
228
|
+
|
|
229
|
+
#### Returns
|
|
230
|
+
|
|
231
|
+
`Promise`\<`undefined` \| `string`\>
|
|
232
|
+
|
|
233
|
+
An identifier for the transfer if there was one.
|
|
234
|
+
|
|
235
|
+
#### Implementation of
|
|
236
|
+
|
|
237
|
+
`IWalletConnector.transfer`
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Class: WalletAddress
|
|
2
|
+
|
|
3
|
+
Class describing a wallet address.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### new WalletAddress()
|
|
8
|
+
|
|
9
|
+
> **new WalletAddress**(): [`WalletAddress`](WalletAddress.md)
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
[`WalletAddress`](WalletAddress.md)
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### address
|
|
18
|
+
|
|
19
|
+
> **address**: `string`
|
|
20
|
+
|
|
21
|
+
The address in the wallet.
|
|
22
|
+
|
|
23
|
+
***
|
|
24
|
+
|
|
25
|
+
### identity
|
|
26
|
+
|
|
27
|
+
> **identity**: `string`
|
|
28
|
+
|
|
29
|
+
The identity of the owner.
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
### balance
|
|
34
|
+
|
|
35
|
+
> **balance**: `string`
|
|
36
|
+
|
|
37
|
+
The balance of the wallet as bigint.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @twin.org/wallet-connector-entity-storage
|
|
2
|
+
|
|
3
|
+
## Classes
|
|
4
|
+
|
|
5
|
+
- [WalletAddress](classes/WalletAddress.md)
|
|
6
|
+
- [EntityStorageFaucetConnector](classes/EntityStorageFaucetConnector.md)
|
|
7
|
+
- [EntityStorageWalletConnector](classes/EntityStorageWalletConnector.md)
|
|
8
|
+
|
|
9
|
+
## Interfaces
|
|
10
|
+
|
|
11
|
+
- [IEntityStorageFaucetConnectorConstructorOptions](interfaces/IEntityStorageFaucetConnectorConstructorOptions.md)
|
|
12
|
+
- [IEntityStorageWalletConnectorConfig](interfaces/IEntityStorageWalletConnectorConfig.md)
|
|
13
|
+
- [IEntityStorageWalletConnectorConstructorOptions](interfaces/IEntityStorageWalletConnectorConstructorOptions.md)
|
|
14
|
+
|
|
15
|
+
## Functions
|
|
16
|
+
|
|
17
|
+
- [initSchema](functions/initSchema.md)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: IEntityStorageFaucetConnectorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the entity storage faucet connector.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### walletAddressEntityStorageType?
|
|
8
|
+
|
|
9
|
+
> `optional` **walletAddressEntityStorageType**: `string`
|
|
10
|
+
|
|
11
|
+
The entity storage type for wallet addresses.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
wallet-address
|
|
17
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Interface: IEntityStorageWalletConnectorConfig
|
|
2
|
+
|
|
3
|
+
Configuration for the Entity Storage Wallet Connector.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### vaultMnemonicId?
|
|
8
|
+
|
|
9
|
+
> `optional` **vaultMnemonicId**: `string`
|
|
10
|
+
|
|
11
|
+
The id of the entry in the vault containing the mnemonic.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
mnemonic
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### coinType?
|
|
22
|
+
|
|
23
|
+
> `optional` **coinType**: `number`
|
|
24
|
+
|
|
25
|
+
The coin type.
|
|
26
|
+
|
|
27
|
+
#### Default
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
9999
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
***
|
|
34
|
+
|
|
35
|
+
### bech32Hrp?
|
|
36
|
+
|
|
37
|
+
> `optional` **bech32Hrp**: `string`
|
|
38
|
+
|
|
39
|
+
The bech32 human readable part for the addresses.
|
|
40
|
+
|
|
41
|
+
#### Default
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
ent
|
|
45
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Interface: IEntityStorageWalletConnectorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the entity storage wallet connector.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### vaultConnectorType?
|
|
8
|
+
|
|
9
|
+
> `optional` **vaultConnectorType**: `string`
|
|
10
|
+
|
|
11
|
+
Vault connector to use for wallet secrets.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
vault
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### faucetConnectorType?
|
|
22
|
+
|
|
23
|
+
> `optional` **faucetConnectorType**: `string`
|
|
24
|
+
|
|
25
|
+
Optional faucet for requesting funds.
|
|
26
|
+
|
|
27
|
+
#### Default
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
faucet
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
***
|
|
34
|
+
|
|
35
|
+
### walletAddressEntityStorageType?
|
|
36
|
+
|
|
37
|
+
> `optional` **walletAddressEntityStorageType**: `string`
|
|
38
|
+
|
|
39
|
+
The entity storage for wallets.
|
|
40
|
+
|
|
41
|
+
#### Default
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
wallet-address
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
***
|
|
48
|
+
|
|
49
|
+
### config?
|
|
50
|
+
|
|
51
|
+
> `optional` **config**: [`IEntityStorageWalletConnectorConfig`](IEntityStorageWalletConnectorConfig.md)
|
|
52
|
+
|
|
53
|
+
The configuration for the wallet connector.
|
package/locales/en.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@twin.org/wallet-connector-entity-storage",
|
|
3
|
+
"version": "0.0.1-next.10",
|
|
4
|
+
"description": "Wallet connector implementation using entity storage",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/twinfoundation/wallet.git",
|
|
8
|
+
"directory": "packages/wallet-connector-entity-storage"
|
|
9
|
+
},
|
|
10
|
+
"author": "martyn.janes@iota.org",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@twin.org/core": "next",
|
|
18
|
+
"@twin.org/crypto": "next",
|
|
19
|
+
"@twin.org/entity": "next",
|
|
20
|
+
"@twin.org/entity-storage-models": "next",
|
|
21
|
+
"@twin.org/nameof": "next",
|
|
22
|
+
"@twin.org/vault-models": "next",
|
|
23
|
+
"@twin.org/wallet-models": "0.0.1-next.10"
|
|
24
|
+
},
|
|
25
|
+
"main": "./dist/cjs/index.cjs",
|
|
26
|
+
"module": "./dist/esm/index.mjs",
|
|
27
|
+
"types": "./dist/types/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"require": "./dist/cjs/index.cjs",
|
|
31
|
+
"import": "./dist/esm/index.mjs",
|
|
32
|
+
"types": "./dist/types/index.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./locales/*.json": "./locales/*.json"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist/cjs",
|
|
38
|
+
"dist/esm",
|
|
39
|
+
"dist/types",
|
|
40
|
+
"locales",
|
|
41
|
+
"docs"
|
|
42
|
+
]
|
|
43
|
+
}
|