@twin.org/wallet-connector-entity-storage 0.0.2-next.3 → 0.0.2-next.5

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.
@@ -55,7 +55,7 @@ class EntityStorageFaucetConnector {
55
55
  /**
56
56
  * Runtime name for the class.
57
57
  */
58
- CLASS_NAME = "EntityStorageFaucetConnector";
58
+ static CLASS_NAME = "EntityStorageFaucetConnector";
59
59
  /**
60
60
  * The entity storage for wallets.
61
61
  * @internal
@@ -76,8 +76,8 @@ class EntityStorageFaucetConnector {
76
76
  * @returns The amount added to the address by the faucet.
77
77
  */
78
78
  async fundAddress(identity, address, timeoutInSeconds = 60) {
79
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
80
- core.Guards.stringValue(this.CLASS_NAME, "address", address);
79
+ core.Guards.stringValue(EntityStorageFaucetConnector.CLASS_NAME, "identity", identity);
80
+ core.Guards.stringValue(EntityStorageFaucetConnector.CLASS_NAME, "address", address);
81
81
  let walletAddress = await this._walletAddressEntityStorage.get(address);
82
82
  if (core.Is.empty(walletAddress)) {
83
83
  walletAddress = {
@@ -100,6 +100,10 @@ class EntityStorageFaucetConnector {
100
100
  * Class for performing wallet operations using in-memory storage.
101
101
  */
102
102
  class EntityStorageWalletConnector {
103
+ /**
104
+ * Runtime name for the class.
105
+ */
106
+ static CLASS_NAME = "EntityStorageWalletConnector";
103
107
  /**
104
108
  * The namespace supported by the wallet connector.
105
109
  */
@@ -119,10 +123,6 @@ class EntityStorageWalletConnector {
119
123
  * @internal
120
124
  */
121
125
  static _DEFAULT_NETWORK_NAME = "ent";
122
- /**
123
- * Runtime name for the class.
124
- */
125
- CLASS_NAME = "EntityStorageWalletConnector";
126
126
  /**
127
127
  * The vault for the mnemonic.
128
128
  * @internal
@@ -161,7 +161,7 @@ class EntityStorageWalletConnector {
161
161
  * @returns Nothing.
162
162
  */
163
163
  async create(identity) {
164
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
164
+ core.Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "identity", identity);
165
165
  const mnemonic = crypto.Bip39.randomMnemonic();
166
166
  await this._vaultConnector.setSecret(this.buildMnemonicKey(identity), mnemonic);
167
167
  }
@@ -174,9 +174,9 @@ class EntityStorageWalletConnector {
174
174
  * @returns The list of addresses.
175
175
  */
176
176
  async getAddresses(identity, accountIndex, startAddressIndex, count) {
177
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
178
- core.Guards.integer(this.CLASS_NAME, "startAddressIndex", startAddressIndex);
179
- core.Guards.integer(this.CLASS_NAME, "count", count);
177
+ core.Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "identity", identity);
178
+ core.Guards.integer(EntityStorageWalletConnector.CLASS_NAME, "startAddressIndex", startAddressIndex);
179
+ core.Guards.integer(EntityStorageWalletConnector.CLASS_NAME, "count", count);
180
180
  const mnemonic = await this._vaultConnector.getSecret(this.buildMnemonicKey(identity));
181
181
  const seed = crypto.Bip39.mnemonicToSeed(mnemonic);
182
182
  const keyPairs = [];
@@ -193,7 +193,7 @@ class EntityStorageWalletConnector {
193
193
  * @returns The balance of the wallet address.
194
194
  */
195
195
  async getBalance(identity, address) {
196
- core.Guards.stringValue(this.CLASS_NAME, "address", address);
196
+ core.Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "address", address);
197
197
  const walletAddress = await this._walletAddressEntityStorage.get(address);
198
198
  return core.Coerce.bigint(walletAddress?.balance) ?? 0n;
199
199
  }
@@ -206,9 +206,9 @@ class EntityStorageWalletConnector {
206
206
  * @returns True if the balance has been ensured.
207
207
  */
208
208
  async ensureBalance(identity, address, ensureBalance, timeoutInSeconds) {
209
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
210
- core.Guards.stringValue(this.CLASS_NAME, "address", address);
211
- core.Guards.bigint(this.CLASS_NAME, "ensureBalance", ensureBalance);
209
+ core.Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "identity", identity);
210
+ core.Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "address", address);
211
+ core.Guards.bigint(EntityStorageWalletConnector.CLASS_NAME, "ensureBalance", ensureBalance);
212
212
  if (this._faucetConnector) {
213
213
  let retryCount = 10;
214
214
  let currentBalance = await this.getBalance(identity, address);
@@ -238,10 +238,10 @@ class EntityStorageWalletConnector {
238
238
  * @returns An identifier for the transfer if there was one.
239
239
  */
240
240
  async transfer(identity, addressSource, addressDest, amount) {
241
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
242
- core.Guards.stringValue(this.CLASS_NAME, "addressSource", addressSource);
243
- core.Guards.stringValue(this.CLASS_NAME, "addressDest", addressDest);
244
- core.Guards.bigint(this.CLASS_NAME, "amount", amount);
241
+ core.Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "identity", identity);
242
+ core.Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "addressSource", addressSource);
243
+ core.Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "addressDest", addressDest);
244
+ core.Guards.bigint(EntityStorageWalletConnector.CLASS_NAME, "amount", amount);
245
245
  const walletAddresses = await this._walletAddressEntityStorage.query({
246
246
  logicalOperator: entity.LogicalOperator.And,
247
247
  conditions: [
@@ -265,7 +265,7 @@ class EntityStorageWalletConnector {
265
265
  walletAddress.balance = (BigInt(walletAddress.balance) - amount).toString();
266
266
  }
267
267
  if (balance < amount) {
268
- throw new core.GeneralError(this.CLASS_NAME, "insufficientFunds");
268
+ throw new core.GeneralError(EntityStorageWalletConnector.CLASS_NAME, "insufficientFunds");
269
269
  }
270
270
  if (!core.Is.empty(walletAddress)) {
271
271
  await this._walletAddressEntityStorage.set(walletAddress);
@@ -53,7 +53,7 @@ class EntityStorageFaucetConnector {
53
53
  /**
54
54
  * Runtime name for the class.
55
55
  */
56
- CLASS_NAME = "EntityStorageFaucetConnector";
56
+ static CLASS_NAME = "EntityStorageFaucetConnector";
57
57
  /**
58
58
  * The entity storage for wallets.
59
59
  * @internal
@@ -74,8 +74,8 @@ class EntityStorageFaucetConnector {
74
74
  * @returns The amount added to the address by the faucet.
75
75
  */
76
76
  async fundAddress(identity, address, timeoutInSeconds = 60) {
77
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
78
- Guards.stringValue(this.CLASS_NAME, "address", address);
77
+ Guards.stringValue(EntityStorageFaucetConnector.CLASS_NAME, "identity", identity);
78
+ Guards.stringValue(EntityStorageFaucetConnector.CLASS_NAME, "address", address);
79
79
  let walletAddress = await this._walletAddressEntityStorage.get(address);
80
80
  if (Is.empty(walletAddress)) {
81
81
  walletAddress = {
@@ -98,6 +98,10 @@ class EntityStorageFaucetConnector {
98
98
  * Class for performing wallet operations using in-memory storage.
99
99
  */
100
100
  class EntityStorageWalletConnector {
101
+ /**
102
+ * Runtime name for the class.
103
+ */
104
+ static CLASS_NAME = "EntityStorageWalletConnector";
101
105
  /**
102
106
  * The namespace supported by the wallet connector.
103
107
  */
@@ -117,10 +121,6 @@ class EntityStorageWalletConnector {
117
121
  * @internal
118
122
  */
119
123
  static _DEFAULT_NETWORK_NAME = "ent";
120
- /**
121
- * Runtime name for the class.
122
- */
123
- CLASS_NAME = "EntityStorageWalletConnector";
124
124
  /**
125
125
  * The vault for the mnemonic.
126
126
  * @internal
@@ -159,7 +159,7 @@ class EntityStorageWalletConnector {
159
159
  * @returns Nothing.
160
160
  */
161
161
  async create(identity) {
162
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
162
+ Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "identity", identity);
163
163
  const mnemonic = Bip39.randomMnemonic();
164
164
  await this._vaultConnector.setSecret(this.buildMnemonicKey(identity), mnemonic);
165
165
  }
@@ -172,9 +172,9 @@ class EntityStorageWalletConnector {
172
172
  * @returns The list of addresses.
173
173
  */
174
174
  async getAddresses(identity, accountIndex, startAddressIndex, count) {
175
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
176
- Guards.integer(this.CLASS_NAME, "startAddressIndex", startAddressIndex);
177
- Guards.integer(this.CLASS_NAME, "count", count);
175
+ Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "identity", identity);
176
+ Guards.integer(EntityStorageWalletConnector.CLASS_NAME, "startAddressIndex", startAddressIndex);
177
+ Guards.integer(EntityStorageWalletConnector.CLASS_NAME, "count", count);
178
178
  const mnemonic = await this._vaultConnector.getSecret(this.buildMnemonicKey(identity));
179
179
  const seed = Bip39.mnemonicToSeed(mnemonic);
180
180
  const keyPairs = [];
@@ -191,7 +191,7 @@ class EntityStorageWalletConnector {
191
191
  * @returns The balance of the wallet address.
192
192
  */
193
193
  async getBalance(identity, address) {
194
- Guards.stringValue(this.CLASS_NAME, "address", address);
194
+ Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "address", address);
195
195
  const walletAddress = await this._walletAddressEntityStorage.get(address);
196
196
  return Coerce.bigint(walletAddress?.balance) ?? 0n;
197
197
  }
@@ -204,9 +204,9 @@ class EntityStorageWalletConnector {
204
204
  * @returns True if the balance has been ensured.
205
205
  */
206
206
  async ensureBalance(identity, address, ensureBalance, timeoutInSeconds) {
207
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
208
- Guards.stringValue(this.CLASS_NAME, "address", address);
209
- Guards.bigint(this.CLASS_NAME, "ensureBalance", ensureBalance);
207
+ Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "identity", identity);
208
+ Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "address", address);
209
+ Guards.bigint(EntityStorageWalletConnector.CLASS_NAME, "ensureBalance", ensureBalance);
210
210
  if (this._faucetConnector) {
211
211
  let retryCount = 10;
212
212
  let currentBalance = await this.getBalance(identity, address);
@@ -236,10 +236,10 @@ class EntityStorageWalletConnector {
236
236
  * @returns An identifier for the transfer if there was one.
237
237
  */
238
238
  async transfer(identity, addressSource, addressDest, amount) {
239
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
240
- Guards.stringValue(this.CLASS_NAME, "addressSource", addressSource);
241
- Guards.stringValue(this.CLASS_NAME, "addressDest", addressDest);
242
- Guards.bigint(this.CLASS_NAME, "amount", amount);
239
+ Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "identity", identity);
240
+ Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "addressSource", addressSource);
241
+ Guards.stringValue(EntityStorageWalletConnector.CLASS_NAME, "addressDest", addressDest);
242
+ Guards.bigint(EntityStorageWalletConnector.CLASS_NAME, "amount", amount);
243
243
  const walletAddresses = await this._walletAddressEntityStorage.query({
244
244
  logicalOperator: LogicalOperator.And,
245
245
  conditions: [
@@ -263,7 +263,7 @@ class EntityStorageWalletConnector {
263
263
  walletAddress.balance = (BigInt(walletAddress.balance) - amount).toString();
264
264
  }
265
265
  if (balance < amount) {
266
- throw new GeneralError(this.CLASS_NAME, "insufficientFunds");
266
+ throw new GeneralError(EntityStorageWalletConnector.CLASS_NAME, "insufficientFunds");
267
267
  }
268
268
  if (!Is.empty(walletAddress)) {
269
269
  await this._walletAddressEntityStorage.set(walletAddress);
@@ -11,7 +11,7 @@ export declare class EntityStorageFaucetConnector implements IFaucetConnector {
11
11
  /**
12
12
  * Runtime name for the class.
13
13
  */
14
- readonly CLASS_NAME: string;
14
+ static readonly CLASS_NAME: string;
15
15
  /**
16
16
  * Create a new instance of EntityStorageFaucetConnector.
17
17
  * @param options The options for the wallet connector.
@@ -5,13 +5,13 @@ import type { IEntityStorageWalletConnectorConstructorOptions } from "./models/I
5
5
  */
6
6
  export declare class EntityStorageWalletConnector implements IWalletConnector {
7
7
  /**
8
- * The namespace supported by the wallet connector.
8
+ * Runtime name for the class.
9
9
  */
10
- static readonly NAMESPACE: string;
10
+ static readonly CLASS_NAME: string;
11
11
  /**
12
- * Runtime name for the class.
12
+ * The namespace supported by the wallet connector.
13
13
  */
14
- readonly CLASS_NAME: string;
14
+ static readonly NAMESPACE: string;
15
15
  /**
16
16
  * Create a new instance of EntityStorageWalletConnector.
17
17
  * @param options The options for the wallet connector.
package/docs/changelog.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @twin.org/wallet-connector-entity-storage - Changelog
2
2
 
3
+ ## [0.0.2-next.5](https://github.com/twinfoundation/wallet/compare/wallet-connector-entity-storage-v0.0.2-next.4...wallet-connector-entity-storage-v0.0.2-next.5) (2025-10-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * add validate-locales ([e5200c2](https://github.com/twinfoundation/wallet/commit/e5200c279de60592b64eeb64279fa8ed289a677f))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/wallet-models bumped from 0.0.2-next.4 to 0.0.2-next.5
16
+
17
+ ## [0.0.2-next.4](https://github.com/twinfoundation/wallet/compare/wallet-connector-entity-storage-v0.0.2-next.3...wallet-connector-entity-storage-v0.0.2-next.4) (2025-08-29)
18
+
19
+
20
+ ### Features
21
+
22
+ * eslint migration to flat config ([7068485](https://github.com/twinfoundation/wallet/commit/7068485f7c10121b76b6219798fdea4d3e91648a))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/wallet-models bumped from 0.0.2-next.3 to 0.0.2-next.4
30
+
3
31
  ## [0.0.2-next.3](https://github.com/twinfoundation/wallet/compare/wallet-connector-entity-storage-v0.0.2-next.2...wallet-connector-entity-storage-v0.0.2-next.3) (2025-08-20)
4
32
 
5
33
 
@@ -38,14 +38,10 @@ The namespace supported by the wallet connector.
38
38
 
39
39
  ### CLASS\_NAME
40
40
 
41
- > `readonly` **CLASS\_NAME**: `string`
41
+ > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
43
43
  Runtime name for the class.
44
44
 
45
- #### Implementation of
46
-
47
- `IFaucetConnector.CLASS_NAME`
48
-
49
45
  ## Methods
50
46
 
51
47
  ### fundAddress()
@@ -28,23 +28,19 @@ The options for the wallet connector.
28
28
 
29
29
  ## Properties
30
30
 
31
- ### NAMESPACE
31
+ ### CLASS\_NAME
32
32
 
33
- > `readonly` `static` **NAMESPACE**: `string` = `"entity-storage"`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
35
- The namespace supported by the wallet connector.
35
+ Runtime name for the class.
36
36
 
37
37
  ***
38
38
 
39
- ### CLASS\_NAME
40
-
41
- > `readonly` **CLASS\_NAME**: `string`
42
-
43
- Runtime name for the class.
39
+ ### NAMESPACE
44
40
 
45
- #### Implementation of
41
+ > `readonly` `static` **NAMESPACE**: `string` = `"entity-storage"`
46
42
 
47
- `IWalletConnector.CLASS_NAME`
43
+ The namespace supported by the wallet connector.
48
44
 
49
45
  ## Methods
50
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/wallet-connector-entity-storage",
3
- "version": "0.0.2-next.3",
3
+ "version": "0.0.2-next.5",
4
4
  "description": "Wallet connector implementation using entity storage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "@twin.org/entity-storage-models": "next",
21
21
  "@twin.org/nameof": "next",
22
22
  "@twin.org/vault-models": "next",
23
- "@twin.org/wallet-models": "0.0.2-next.3"
23
+ "@twin.org/wallet-models": "0.0.2-next.5"
24
24
  },
25
25
  "main": "./dist/cjs/index.cjs",
26
26
  "module": "./dist/esm/index.mjs",
@@ -39,5 +39,27 @@
39
39
  "dist/types",
40
40
  "locales",
41
41
  "docs"
42
- ]
42
+ ],
43
+ "keywords": [
44
+ "twin",
45
+ "trade",
46
+ "iota",
47
+ "framework",
48
+ "blockchain",
49
+ "wallet",
50
+ "keys",
51
+ "signing",
52
+ "accounts",
53
+ "entity",
54
+ "storage",
55
+ "persistence",
56
+ "database",
57
+ "connector",
58
+ "adapter",
59
+ "integration"
60
+ ],
61
+ "bugs": {
62
+ "url": "git+https://github.com/twinfoundation/wallet/issues"
63
+ },
64
+ "homepage": "https://twindev.org"
43
65
  }