@twin.org/wallet-connector-entity-storage 0.0.1-next.3
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 +312 -0
- package/dist/cjs/iota_sdk_wasm_bg.wasm +0 -0
- package/dist/esm/index.mjs +308 -0
- package/dist/esm/iota_sdk_wasm_bg.wasm +0 -0
- package/dist/types/entities/walletAddress.d.ts +17 -0
- package/dist/types/entityStorageFaucetConnector.d.ts +30 -0
- package/dist/types/entityStorageWalletConnector.d.ts +69 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/models/IEntityStorageWalletConnectorConfig.d.ts +20 -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 +81 -0
- package/docs/reference/classes/EntityStorageWalletConnector.md +221 -0
- package/docs/reference/classes/WalletAddress.md +37 -0
- package/docs/reference/functions/initSchema.md +9 -0
- package/docs/reference/index.md +15 -0
- package/docs/reference/interfaces/IEntityStorageWalletConnectorConfig.md +45 -0
- package/locales/en.json +7 -0
- package/package.json +73 -0
|
@@ -0,0 +1,221 @@
|
|
|
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
|
+
The options for the wallet connector.
|
|
22
|
+
|
|
23
|
+
• **options.vaultConnectorType?**: `string`
|
|
24
|
+
|
|
25
|
+
Vault connector to use for wallet secrets, defaults to "vault".
|
|
26
|
+
|
|
27
|
+
• **options.faucetConnectorType?**: `string`
|
|
28
|
+
|
|
29
|
+
Optional faucet for requesting funds, defaults to "faucet".
|
|
30
|
+
|
|
31
|
+
• **options.walletAddressEntityStorageType?**: `string`
|
|
32
|
+
|
|
33
|
+
The entity storage for wallets, defaults to "wallet-address".
|
|
34
|
+
|
|
35
|
+
• **options.config?**: [`IEntityStorageWalletConnectorConfig`](../interfaces/IEntityStorageWalletConnectorConfig.md)
|
|
36
|
+
|
|
37
|
+
The configuration to use.
|
|
38
|
+
|
|
39
|
+
#### Returns
|
|
40
|
+
|
|
41
|
+
[`EntityStorageWalletConnector`](EntityStorageWalletConnector.md)
|
|
42
|
+
|
|
43
|
+
## Properties
|
|
44
|
+
|
|
45
|
+
### NAMESPACE
|
|
46
|
+
|
|
47
|
+
> `readonly` `static` **NAMESPACE**: `string` = `"entity-storage"`
|
|
48
|
+
|
|
49
|
+
The namespace supported by the wallet connector.
|
|
50
|
+
|
|
51
|
+
***
|
|
52
|
+
|
|
53
|
+
### CLASS\_NAME
|
|
54
|
+
|
|
55
|
+
> `readonly` **CLASS\_NAME**: `string`
|
|
56
|
+
|
|
57
|
+
Runtime name for the class.
|
|
58
|
+
|
|
59
|
+
#### Implementation of
|
|
60
|
+
|
|
61
|
+
`IWalletConnector.CLASS_NAME`
|
|
62
|
+
|
|
63
|
+
## Methods
|
|
64
|
+
|
|
65
|
+
### create()
|
|
66
|
+
|
|
67
|
+
> **create**(`identity`): `Promise`\<`void`\>
|
|
68
|
+
|
|
69
|
+
Create a new wallet.
|
|
70
|
+
|
|
71
|
+
#### Parameters
|
|
72
|
+
|
|
73
|
+
• **identity**: `string`
|
|
74
|
+
|
|
75
|
+
The identity of the user to access the vault keys.
|
|
76
|
+
|
|
77
|
+
#### Returns
|
|
78
|
+
|
|
79
|
+
`Promise`\<`void`\>
|
|
80
|
+
|
|
81
|
+
Nothing.
|
|
82
|
+
|
|
83
|
+
#### Implementation of
|
|
84
|
+
|
|
85
|
+
`IWalletConnector.create`
|
|
86
|
+
|
|
87
|
+
***
|
|
88
|
+
|
|
89
|
+
### getAddresses()
|
|
90
|
+
|
|
91
|
+
> **getAddresses**(`identity`, `accountIndex`, `startAddressIndex`, `count`): `Promise`\<`string`[]\>
|
|
92
|
+
|
|
93
|
+
Get the addresses for the requested range.
|
|
94
|
+
|
|
95
|
+
#### Parameters
|
|
96
|
+
|
|
97
|
+
• **identity**: `string`
|
|
98
|
+
|
|
99
|
+
The identity of the user to access the vault keys.
|
|
100
|
+
|
|
101
|
+
• **accountIndex**: `number`
|
|
102
|
+
|
|
103
|
+
The account index to get the addresses for.
|
|
104
|
+
|
|
105
|
+
• **startAddressIndex**: `number`
|
|
106
|
+
|
|
107
|
+
The start index for the addresses.
|
|
108
|
+
|
|
109
|
+
• **count**: `number`
|
|
110
|
+
|
|
111
|
+
The number of addresses to generate.
|
|
112
|
+
|
|
113
|
+
#### Returns
|
|
114
|
+
|
|
115
|
+
`Promise`\<`string`[]\>
|
|
116
|
+
|
|
117
|
+
The list of addresses.
|
|
118
|
+
|
|
119
|
+
#### Implementation of
|
|
120
|
+
|
|
121
|
+
`IWalletConnector.getAddresses`
|
|
122
|
+
|
|
123
|
+
***
|
|
124
|
+
|
|
125
|
+
### getBalance()
|
|
126
|
+
|
|
127
|
+
> **getBalance**(`identity`, `address`): `Promise`\<`bigint`\>
|
|
128
|
+
|
|
129
|
+
Get the balance for an address in a wallet.
|
|
130
|
+
|
|
131
|
+
#### Parameters
|
|
132
|
+
|
|
133
|
+
• **identity**: `string`
|
|
134
|
+
|
|
135
|
+
The identity of the user to access the vault keys.
|
|
136
|
+
|
|
137
|
+
• **address**: `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**: `string`
|
|
162
|
+
|
|
163
|
+
The identity of the user to access the vault keys.
|
|
164
|
+
|
|
165
|
+
• **address**: `string`
|
|
166
|
+
|
|
167
|
+
The bech32 encoded address.
|
|
168
|
+
|
|
169
|
+
• **ensureBalance**: `bigint`
|
|
170
|
+
|
|
171
|
+
The balance to ensure on the address.
|
|
172
|
+
|
|
173
|
+
• **timeoutInSeconds?**: `number`
|
|
174
|
+
|
|
175
|
+
The timeout in seconds to wait for the funding to complete.
|
|
176
|
+
|
|
177
|
+
#### Returns
|
|
178
|
+
|
|
179
|
+
`Promise`\<`boolean`\>
|
|
180
|
+
|
|
181
|
+
True if the balance has been ensured.
|
|
182
|
+
|
|
183
|
+
#### Implementation of
|
|
184
|
+
|
|
185
|
+
`IWalletConnector.ensureBalance`
|
|
186
|
+
|
|
187
|
+
***
|
|
188
|
+
|
|
189
|
+
### transfer()
|
|
190
|
+
|
|
191
|
+
> **transfer**(`identity`, `addressSource`, `addressDest`, `amount`): `Promise`\<`undefined` \| `string`\>
|
|
192
|
+
|
|
193
|
+
Transfer funds to an address.
|
|
194
|
+
|
|
195
|
+
#### Parameters
|
|
196
|
+
|
|
197
|
+
• **identity**: `string`
|
|
198
|
+
|
|
199
|
+
The identity of the user to access the vault keys.
|
|
200
|
+
|
|
201
|
+
• **addressSource**: `string`
|
|
202
|
+
|
|
203
|
+
The bech32 encoded address to send the funds from.
|
|
204
|
+
|
|
205
|
+
• **addressDest**: `string`
|
|
206
|
+
|
|
207
|
+
The bech32 encoded address to send the funds to.
|
|
208
|
+
|
|
209
|
+
• **amount**: `bigint`
|
|
210
|
+
|
|
211
|
+
The amount to transfer.
|
|
212
|
+
|
|
213
|
+
#### Returns
|
|
214
|
+
|
|
215
|
+
`Promise`\<`undefined` \| `string`\>
|
|
216
|
+
|
|
217
|
+
An identifier for the transfer if there was one.
|
|
218
|
+
|
|
219
|
+
#### Implementation of
|
|
220
|
+
|
|
221
|
+
`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,15 @@
|
|
|
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
|
+
- [IEntityStorageWalletConnectorConfig](interfaces/IEntityStorageWalletConnectorConfig.md)
|
|
12
|
+
|
|
13
|
+
## Functions
|
|
14
|
+
|
|
15
|
+
- [initSchema](functions/initSchema.md)
|
|
@@ -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
|
+
```
|
package/locales/en.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@twin.org/wallet-connector-entity-storage",
|
|
3
|
+
"version": "0.0.1-next.3",
|
|
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
|
+
"scripts": {
|
|
17
|
+
"clean": "rimraf dist coverage docs/reference",
|
|
18
|
+
"build": "tspc",
|
|
19
|
+
"test": "vitest --run --config ./vitest.config.ts --no-cache",
|
|
20
|
+
"coverage": "vitest --run --coverage --config ./vitest.config.ts --no-cache",
|
|
21
|
+
"bundle:esm": "rollup --config rollup.config.mjs --environment MODULE:esm",
|
|
22
|
+
"bundle:cjs": "rollup --config rollup.config.mjs --environment MODULE:cjs",
|
|
23
|
+
"bundle": "npm run bundle:esm && npm run bundle:cjs",
|
|
24
|
+
"docs:clean": "rimraf docs/reference",
|
|
25
|
+
"docs:generate": "typedoc",
|
|
26
|
+
"docs": "npm run docs:clean && npm run docs:generate",
|
|
27
|
+
"dist": "npm run clean && npm run build && npm run test && npm run bundle && npm run docs"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@twin.org/core": "next",
|
|
31
|
+
"@twin.org/crypto": "next",
|
|
32
|
+
"@twin.org/entity": "next",
|
|
33
|
+
"@twin.org/entity-storage-models": "next",
|
|
34
|
+
"@twin.org/nameof": "next",
|
|
35
|
+
"@twin.org/vault-models": "next",
|
|
36
|
+
"@twin.org/wallet-models": "0.0.1-next.3"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@twin.org/nameof-transformer": "next",
|
|
40
|
+
"@twin.org/entity-storage-connector-memory": "next",
|
|
41
|
+
"@twin.org/vault-connector-entity-storage": "next",
|
|
42
|
+
"@vitest/coverage-v8": "2.1.1",
|
|
43
|
+
"copyfiles": "2.4.1",
|
|
44
|
+
"dotenv": "16.4.5",
|
|
45
|
+
"rimraf": "6.0.1",
|
|
46
|
+
"rollup": "4.22.0",
|
|
47
|
+
"rollup-plugin-copy": "3.5.0",
|
|
48
|
+
"rollup-plugin-typescript2": "0.36.0",
|
|
49
|
+
"ts-patch": "3.2.1",
|
|
50
|
+
"typedoc": "0.26.7",
|
|
51
|
+
"typedoc-plugin-markdown": "4.2.7",
|
|
52
|
+
"typescript": "5.6.2",
|
|
53
|
+
"vitest": "2.1.1"
|
|
54
|
+
},
|
|
55
|
+
"main": "./dist/cjs/index.cjs",
|
|
56
|
+
"module": "./dist/esm/index.mjs",
|
|
57
|
+
"types": "./dist/types/index.d.ts",
|
|
58
|
+
"exports": {
|
|
59
|
+
".": {
|
|
60
|
+
"require": "./dist/cjs/index.cjs",
|
|
61
|
+
"import": "./dist/esm/index.mjs",
|
|
62
|
+
"types": "./dist/types/index.d.ts"
|
|
63
|
+
},
|
|
64
|
+
"./locales": "./locales"
|
|
65
|
+
},
|
|
66
|
+
"files": [
|
|
67
|
+
"dist/cjs",
|
|
68
|
+
"dist/esm",
|
|
69
|
+
"dist/types",
|
|
70
|
+
"locales",
|
|
71
|
+
"docs"
|
|
72
|
+
]
|
|
73
|
+
}
|