@cityofzion/bs-neo-legacy 0.8.0 → 0.9.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.
@@ -1,3 +1,3 @@
1
1
  {
2
- "nonCachedDurationMs": 2055.2105630000005
2
+ "nonCachedDurationMs": 2075.0556579999975
3
3
  }
@@ -2,13 +2,13 @@
2
2
  "files": {
3
3
  "packages/bs-neo-legacy/jest.config.ts": "d944475db93cbe41a9339187fd94b9962e411c43",
4
4
  "packages/bs-neo-legacy/jest.setup.ts": "9a1976a32050616d4d2ee95b1aa21041bc4daca3",
5
- "packages/bs-neo-legacy/package.json": "bd65fd31f53ac25888d98fdcd2697e654f7bedb9",
6
- "packages/bs-neo-legacy/src/BSNeoLegacy.ts": "92e664e23d0d1bb757b901a66d6d33650c490faf",
5
+ "packages/bs-neo-legacy/package.json": "4bd169b7e7b00f102f684d0a9bf3353b4c33db7b",
6
+ "packages/bs-neo-legacy/src/BSNeoLegacy.ts": "ae1661b8f41439129b8dfde119d409426712156b",
7
7
  "packages/bs-neo-legacy/src/CryptoCompareEDSNeoLegacy.ts": "baafce35ec622b2b2d80afa020f084daf6d4d59a",
8
8
  "packages/bs-neo-legacy/src/DoraBDSNeoLegacy.ts": "022c8627f74e635025cfe0035e6ef259ddc4dd6a",
9
9
  "packages/bs-neo-legacy/src/DoraESNeoLegacy.ts": "e12df08893ac0bb0f0daecf2b61a96d9c7532bf4",
10
10
  "packages/bs-neo-legacy/src/__tests__/BDSNeoLegacy.spec.ts": "04210ed3cc8b8afbc824417be87eac06d1f875fd",
11
- "packages/bs-neo-legacy/src/__tests__/BSNeoLegacy.spec.ts": "b2cff48a43db986fc02fdefbfd66a5cd4d70a5d9",
11
+ "packages/bs-neo-legacy/src/__tests__/BSNeoLegacy.spec.ts": "ac469e400c619b0cd8e04a81feda51c6575f0025",
12
12
  "packages/bs-neo-legacy/src/__tests__/CryptoCompareExchange.spec.ts": "0469dc99648308249eab837f1450537afd516948",
13
13
  "packages/bs-neo-legacy/src/__tests__/DoraESNeoLegacy.spec.ts": "4ea3298204b96536f3e143e29e1ba6f94ce90b31",
14
14
  "packages/bs-neo-legacy/src/assets/tokens/common.json": "81b0a9bb3e6c1b5bb41f57e6b1fc403ce1ac1489",
@@ -18,8 +18,8 @@
18
18
  "packages/bs-neo-legacy/tsconfig.build.json": "4dc23fb9c4c5e4d19a9bc3947a47c523f4bd967c",
19
19
  "packages/bs-neo-legacy/tsconfig.json": "77cf2b789e9c665b62792f9992cc81ae86296ef7",
20
20
  "packages/bs-neo-legacy/.rush/temp/shrinkwrap-deps.json": "8696152af4c8b42127213e7f9bbd0c284659a686",
21
- "packages/bs-neo-legacy/CHANGELOG.json": "1ba8b57cc66702c91280baae0bcadaf1bd89dd74",
22
- "packages/bs-neo-legacy/CHANGELOG.md": "6076e67d18266f96e182894a3787e106beebe09c"
21
+ "packages/bs-neo-legacy/CHANGELOG.json": "0e00d4e0600b177ffda3550e9e188d50d165d156",
22
+ "packages/bs-neo-legacy/CHANGELOG.md": "5b736bb30819f0db308482f26f723850d76893f9"
23
23
  },
24
24
  "arguments": "tsc --project tsconfig.build.json "
25
25
  }
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@cityofzion/bs-neo-legacy",
3
3
  "entries": [
4
4
  {
5
- "version": "0.8.0",
6
- "tag": "@cityofzion/bs-neo-legacy_v0.8.0",
7
- "date": "Mon, 27 Nov 2023 22:13:46 GMT",
5
+ "version": "0.9.0",
6
+ "tag": "@cityofzion/bs-neo-legacy_v0.9.0",
7
+ "date": "Tue, 05 Dec 2023 18:42:10 GMT",
8
8
  "comments": {
9
9
  "minor": [
10
10
  {
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "dependency": [
15
15
  {
16
- "comment": "Updating dependency \"@cityofzion/blockchain-service\" to `0.8.0`"
16
+ "comment": "Updating dependency \"@cityofzion/blockchain-service\" to `0.9.0`"
17
17
  }
18
18
  ]
19
19
  }
package/CHANGELOG.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Change Log - @cityofzion/bs-neo-legacy
2
2
 
3
- This log was last generated on Mon, 27 Nov 2023 22:13:46 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 05 Dec 2023 18:42:10 GMT and should not be manually modified.
4
4
 
5
- ## 0.8.0
6
- Mon, 27 Nov 2023 22:13:46 GMT
5
+ ## 0.9.0
6
+ Tue, 05 Dec 2023 18:42:10 GMT
7
7
 
8
8
  ### Minor changes
9
9
 
@@ -19,6 +19,7 @@ export declare class BSNeoLegacy<BSCustomName extends string = string> implement
19
19
  generateAccountFromMnemonic(mnemonic: string[] | string, index: number): AccountWithDerivationPath;
20
20
  generateAccountFromKey(key: string): Account;
21
21
  decrypt(encryptedKey: string, password: string): Promise<Account>;
22
+ encrypt(key: string, password: string): Promise<string>;
22
23
  transfer({ intent: transferIntent, senderAccount, tipIntent, ...params }: TransferParam): Promise<string>;
23
24
  claim(account: Account): Promise<string>;
24
25
  }
@@ -95,6 +95,9 @@ class BSNeoLegacy {
95
95
  return this.generateAccountFromKey(privateKey);
96
96
  });
97
97
  }
98
+ encrypt(key, password) {
99
+ return neon_js_1.wallet.encrypt(key, password);
100
+ }
98
101
  transfer(_a) {
99
102
  var _b, _c;
100
103
  var { intent: transferIntent, senderAccount, tipIntent } = _a, params = __rest(_a, ["intent", "senderAccount", "tipIntent"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-neo-legacy",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "Coz",
@@ -9,7 +9,7 @@
9
9
  "@cityofzion/dora-ts": "0.0.11",
10
10
  "@cityofzion/neon-js": "4.8.3",
11
11
  "axios": "1.5.1",
12
- "@cityofzion/blockchain-service": "0.8.0",
12
+ "@cityofzion/blockchain-service": "0.9.0",
13
13
  "@cityofzion/bs-asteroid-sdk": "0.7.3"
14
14
  },
15
15
  "devDependencies": {
@@ -116,6 +116,10 @@ export class BSNeoLegacy<BSCustomName extends string = string>
116
116
  return this.generateAccountFromKey(privateKey)
117
117
  }
118
118
 
119
+ encrypt(key: string, password: string): Promise<string> {
120
+ return wallet.encrypt(key, password)
121
+ }
122
+
119
123
  async transfer({ intent: transferIntent, senderAccount, tipIntent, ...params }: TransferParam): Promise<string> {
120
124
  const apiProvider = new api.neoCli.instance(this.network.url)
121
125
  const account = new wallet.Account(senderAccount.key)
@@ -53,11 +53,19 @@ describe('BSNeoLegacy', () => {
53
53
  const mnemonic = generateMnemonic()
54
54
  const account = bsNeoLegacy.generateAccountFromMnemonic(mnemonic, 0)
55
55
  const password = 'TestPassword'
56
- const encryptedKey = await wallet.encrypt(account.key, password)
56
+ const encryptedKey = await bsNeoLegacy.encrypt(account.key, password)
57
57
  const decryptedAccount = await bsNeoLegacy.decrypt(encryptedKey, password)
58
58
  expect(account).toEqual(expect.objectContaining(decryptedAccount))
59
59
  }, 10000)
60
60
 
61
+ it('Should be able to encrypt a key', async () => {
62
+ const mnemonic = generateMnemonic()
63
+ const account = bsNeoLegacy.generateAccountFromMnemonic(mnemonic, 0)
64
+ const password = 'TestPassword'
65
+ const encryptedKey = await bsNeoLegacy.encrypt(account.key, password)
66
+ expect(encryptedKey).toEqual(expect.any(String))
67
+ })
68
+
61
69
  it.skip('Should be able to transfer a native asset', async () => {
62
70
  const account = bsNeoLegacy.generateAccountFromKey(process.env.TESTNET_PRIVATE_KEY as string)
63
71
  const balance = await bsNeoLegacy.blockchainDataService.getBalance(account.address)