@mainsail/crypto-address-base58 0.0.1-alpha.2 → 0.0.1-alpha.20

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 ADDED
@@ -0,0 +1,19 @@
1
+ # Mainsail - Crypto address Base58
2
+
3
+ ![banner](https://raw.githubusercontent.com/ArkEcosystem/mainsail/main/banner.jpeg)
4
+
5
+ ## Documentation
6
+
7
+ You can find installation instructions and detailed instructions on how to use this package at the [dedicated documentation site](https://ark.dev/docs/mainsail).
8
+
9
+ ## Security
10
+
11
+ If you discover a security vulnerability within this package, please send an e-mail to [security@ark.io](mailto:security@ark.io). All security vulnerabilities will be promptly addressed.
12
+
13
+ ## Credits
14
+
15
+ This project exists thanks to all the people who [contribute](https://github.com/ArkEcosystem/mainsail/graphs/contributors).
16
+
17
+ ## License
18
+
19
+ [GPL-3.0-only](https://github.com/ArkEcosystem/mainsail/blob/main/LICENSE) © [ARK Ecosystem](https://ark.io)
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
2
  import { Contracts } from "@mainsail/contracts";
3
3
  export declare class AddressFactory implements Contracts.Crypto.AddressFactory {
4
4
  #private;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -14,12 +13,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
14
13
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
14
  };
16
15
  var _AddressFactory_instances, _AddressFactory_encodeCheck, _AddressFactory_decodeCheck;
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.AddressFactory = void 0;
19
- const container_1 = require("@mainsail/container");
20
- const contracts_1 = require("@mainsail/contracts");
21
- const bcrypto_1 = require("bcrypto");
22
- const bstring_1 = require("bstring");
16
+ import { inject, injectable, tagged } from "@mainsail/container";
17
+ import { Contracts, Identifiers } from "@mainsail/contracts";
18
+ import { Hash256, RIPEMD160 } from "bcrypto";
19
+ import { base58 } from "bstring";
23
20
  let AddressFactory = class AddressFactory {
24
21
  constructor() {
25
22
  _AddressFactory_instances.add(this);
@@ -28,7 +25,7 @@ let AddressFactory = class AddressFactory {
28
25
  return this.fromPublicKey((await this.keyPairFactory.fromMnemonic(passphrase)).publicKey);
29
26
  }
30
27
  async fromPublicKey(publicKey) {
31
- const buffer = bcrypto_1.RIPEMD160.digest(Buffer.from(publicKey, "hex"));
28
+ const buffer = RIPEMD160.digest(Buffer.from(publicKey, "hex"));
32
29
  const payload = Buffer.alloc(21);
33
30
  payload.writeUInt8(this.configuration.getMilestone().address.base58, 0);
34
31
  buffer.copy(payload, 1);
@@ -63,36 +60,36 @@ let AddressFactory = class AddressFactory {
63
60
  }
64
61
  }
65
62
  };
66
- exports.AddressFactory = AddressFactory;
67
63
  _AddressFactory_instances = new WeakSet();
68
64
  _AddressFactory_encodeCheck = function _AddressFactory_encodeCheck(buffer) {
69
- const checksum = bcrypto_1.Hash256.digest(buffer);
70
- return bstring_1.base58.encode(Buffer.concat([buffer, checksum], buffer.length + 4));
65
+ const checksum = Hash256.digest(buffer);
66
+ return base58.encode(Buffer.concat([buffer, checksum], buffer.length + 4));
71
67
  };
72
68
  _AddressFactory_decodeCheck = function _AddressFactory_decodeCheck(address) {
73
- const buffer = bstring_1.base58.decode(address);
69
+ const buffer = base58.decode(address);
74
70
  const payload = buffer.subarray(0, -4);
75
- const checksum = bcrypto_1.Hash256.digest(payload);
71
+ const checksum = Hash256.digest(payload);
76
72
  if (checksum.readUInt32LE(0) !== buffer.subarray(-4).readUInt32LE(0)) {
77
73
  throw new Error("Invalid checksum for base58 string.");
78
74
  }
79
75
  return payload;
80
76
  };
81
77
  __decorate([
82
- (0, container_1.inject)(contracts_1.Identifiers.Cryptography.Configuration),
78
+ inject(Identifiers.Cryptography.Configuration),
83
79
  __metadata("design:type", Object)
84
80
  ], AddressFactory.prototype, "configuration", void 0);
85
81
  __decorate([
86
- (0, container_1.inject)(contracts_1.Identifiers.Cryptography.Identity.KeyPair.Factory),
87
- (0, container_1.tagged)("type", "wallet"),
82
+ inject(Identifiers.Cryptography.Identity.KeyPair.Factory),
83
+ tagged("type", "wallet"),
88
84
  __metadata("design:type", Object)
89
85
  ], AddressFactory.prototype, "keyPairFactory", void 0);
90
86
  __decorate([
91
- (0, container_1.inject)(contracts_1.Identifiers.Cryptography.Identity.PublicKey.Factory),
92
- (0, container_1.tagged)("type", "wallet"),
87
+ inject(Identifiers.Cryptography.Identity.PublicKey.Factory),
88
+ tagged("type", "wallet"),
93
89
  __metadata("design:type", Object)
94
90
  ], AddressFactory.prototype, "publicKeyFactory", void 0);
95
- exports.AddressFactory = AddressFactory = __decorate([
96
- (0, container_1.injectable)()
91
+ AddressFactory = __decorate([
92
+ injectable()
97
93
  ], AddressFactory);
94
+ export { AddressFactory };
98
95
  //# sourceMappingURL=address.factory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"address.factory.js","sourceRoot":"","sources":["../source/address.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,mDAAiE;AACjE,mDAA6D;AAC7D,qCAA6C;AAC7C,qCAAiC;AAG1B,IAAM,cAAc,GAApB,MAAM,cAAc;IAApB;;IA+EP,CAAC;IAnEO,KAAK,CAAC,YAAY,CAAC,UAAkB;QAC3C,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC3F,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,SAAiB;QAC3C,MAAM,MAAM,GAAW,mBAAS,CAAC,MAAM,CAAC,MAAM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C,MAAM,EAAE,QAAQ,CAAC;;wDAC6C;AAV1D,cAAc;IAD1B,UAAU,EAAE;GACA,cAAc,CA+E1B"}
@@ -1,8 +1,7 @@
1
1
  import { Providers } from "@mainsail/kernel";
2
- export * from "./schemas";
2
+ export * from "./schemas.js";
3
3
  export declare class ServiceProvider extends Providers.ServiceProvider {
4
4
  #private;
5
5
  register(): Promise<void>;
6
- requiredByWorker(): boolean;
7
6
  }
8
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAM7C,cAAc,WAAW,CAAC;AAE1B,qBAAa,eAAgB,SAAQ,SAAS,CAAC,eAAe;;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAS/B,gBAAgB,IAAI,OAAO;CASlC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAM7C,cAAc,cAAc,CAAC;AAE7B,qBAAa,eAAgB,SAAQ,SAAS,CAAC,eAAe;;IAChD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CActC"}
@@ -1,51 +1,30 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
1
  var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
17
2
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
18
3
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
19
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
20
5
  };
21
6
  var _ServiceProvider_instances, _ServiceProvider_registerSchemas;
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.ServiceProvider = void 0;
24
- const contracts_1 = require("@mainsail/contracts");
25
- const kernel_1 = require("@mainsail/kernel");
26
- const address_factory_1 = require("./address.factory");
27
- const schemas_1 = require("./schemas");
28
- const serializer_1 = require("./serializer");
29
- __exportStar(require("./schemas"), exports);
30
- class ServiceProvider extends kernel_1.Providers.ServiceProvider {
7
+ import { Identifiers } from "@mainsail/contracts";
8
+ import { Providers } from "@mainsail/kernel";
9
+ import { AddressFactory } from "./address.factory.js";
10
+ import { schemas } from "./schemas.js";
11
+ import { AddressSerializer } from "./serializer.js";
12
+ export * from "./schemas.js";
13
+ export class ServiceProvider extends Providers.ServiceProvider {
31
14
  constructor() {
32
15
  super(...arguments);
33
16
  _ServiceProvider_instances.add(this);
34
17
  }
35
18
  async register() {
36
- this.app.bind(contracts_1.Identifiers.Cryptography.Identity.Address.Size).toConstantValue(21);
37
- this.app.bind(contracts_1.Identifiers.Cryptography.Identity.Address.Factory).to(address_factory_1.AddressFactory).inSingletonScope();
38
- this.app.bind(contracts_1.Identifiers.Cryptography.Identity.Address.Serializer).to(serializer_1.AddressSerializer).inSingletonScope();
19
+ this.app.bind(Identifiers.Cryptography.Identity.Address.Size).toConstantValue(21);
20
+ this.app.bind(Identifiers.Cryptography.Identity.Address.Factory).to(AddressFactory).inSingletonScope();
21
+ this.app.bind(Identifiers.Cryptography.Identity.Address.Serializer).to(AddressSerializer).inSingletonScope();
39
22
  __classPrivateFieldGet(this, _ServiceProvider_instances, "m", _ServiceProvider_registerSchemas).call(this);
40
23
  }
41
- requiredByWorker() {
42
- return true;
43
- }
44
24
  }
45
- exports.ServiceProvider = ServiceProvider;
46
25
  _ServiceProvider_instances = new WeakSet(), _ServiceProvider_registerSchemas = function _ServiceProvider_registerSchemas() {
47
- for (const schema of Object.values(schemas_1.schemas)) {
48
- this.app.get(contracts_1.Identifiers.Cryptography.Validator).addSchema(schema);
26
+ for (const schema of Object.values(schemas)) {
27
+ this.app.get(Identifiers.Cryptography.Validator).addSchema(schema);
49
28
  }
50
29
  };
51
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA6D;AAC7D,6CAA6C;AAE7C,uDAAmD;AACnD,uCAAoC;AACpC,6CAAiD;AAEjD,4CAA0B;AAE1B,MAAa,eAAgB,SAAQ,kBAAS,CAAC,eAAe;IAA9D;;;IAmBA,CAAC;IAlBO,KAAK,CAAC,QAAQ;QACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAElF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,gCAAc,CAAC,CAAC,gBAAgB,EAAE,CAAC;QACvG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,8BAAiB,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAE7G,uBAAA,IAAI,oEAAiB,MAArB,IAAI,CAAmB,CAAC;IACzB,CAAC;IAEM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,IAAI,CAAmB,CAAC;IACzB,CAAC;CAOD;;IAJC,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,GAAG,CAAC,GAAG,CAA6B,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAChG,CAAC;AACF,CAAC"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.schemas = void 0;
4
- exports.schemas = {
1
+ export const schemas = {
5
2
  address: {
6
3
  $id: "address",
7
4
  allOf: [
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG;IACtB,OAAO,EAAE;QACR,GAAG,EAAE,SAAS;QACd,KAAK,EAAE;YACN;gBACC,SAAS,EAAE,EAAE;gBACb,SAAS,EAAE,EAAE;gBACb,OAAO,EAAE,iEAAiE;aAC1E;SACD;QACD,IAAI,EAAE,QAAQ;KACd;CACD,CAAC"}
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG;IACtB,OAAO,EAAE;QACR,GAAG,EAAE,SAAS;QACd,KAAK,EAAE;YACN;gBACC,SAAS,EAAE,EAAE;gBACb,SAAS,EAAE,EAAE;gBACb,OAAO,EAAE,iEAAiE;aAC1E;SACD;QACD,IAAI,EAAE,QAAQ;KACd;CACD,CAAC"}
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
2
  import { Contracts } from "@mainsail/contracts";
3
3
  import { ByteBuffer } from "@mainsail/utils";
4
4
  export declare class AddressSerializer implements Contracts.Crypto.AddressSerializer {
@@ -1,13 +1,10 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
6
  };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.AddressSerializer = void 0;
10
- const container_1 = require("@mainsail/container");
7
+ import { injectable } from "@mainsail/container";
11
8
  let AddressSerializer = class AddressSerializer {
12
9
  serialize(buffer, address) {
13
10
  buffer.writeBytes(address);
@@ -16,8 +13,8 @@ let AddressSerializer = class AddressSerializer {
16
13
  return buffer.readBytes(21);
17
14
  }
18
15
  };
19
- exports.AddressSerializer = AddressSerializer;
20
- exports.AddressSerializer = AddressSerializer = __decorate([
21
- (0, container_1.injectable)()
16
+ AddressSerializer = __decorate([
17
+ injectable()
22
18
  ], AddressSerializer);
19
+ export { AddressSerializer };
23
20
  //# sourceMappingURL=serializer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.js","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAiD;AAK1C,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IACtB,SAAS,CAAC,MAAkB,EAAE,OAAe;QACnD,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAEM,WAAW,CAAC,MAAkB;QACpC,OAAO,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;CACD,CAAA;AARY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,sBAAU,GAAE;GACA,iBAAiB,CAQ7B"}
1
+ {"version":3,"file":"serializer.js","sourceRoot":"","sources":["../source/serializer.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAK1C,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IACtB,SAAS,CAAC,MAAkB,EAAE,OAAe;QACnD,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAEM,WAAW,CAAC,MAAkB;QACpC,OAAO,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;CACD,CAAA;AARY,iBAAiB;IAD7B,UAAU,EAAE;GACA,iBAAiB,CAQ7B"}
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@mainsail/crypto-address-base58",
3
- "version": "0.0.1-alpha.2",
3
+ "version": "0.0.1-alpha.20",
4
4
  "description": "Base58 address derivation for the Mainsail blockchain",
5
5
  "license": "GPL-3.0-only",
6
6
  "contributors": [],
7
+ "type": "module",
7
8
  "main": "distribution/index.js",
8
9
  "types": "distribution/index.d.ts",
9
10
  "files": [
@@ -12,19 +13,19 @@
12
13
  "dependencies": {
13
14
  "bcrypto": "5.5.2",
14
15
  "bstring": "0.3.9",
15
- "@mainsail/container": "0.0.1-alpha.2",
16
- "@mainsail/contracts": "0.0.1-alpha.2",
17
- "@mainsail/kernel": "0.0.1-alpha.2",
18
- "@mainsail/utils": "0.0.1-alpha.2"
16
+ "@mainsail/contracts": "0.0.1-alpha.20",
17
+ "@mainsail/kernel": "0.0.1-alpha.20",
18
+ "@mainsail/utils": "0.0.1-alpha.20",
19
+ "@mainsail/container": "0.0.1-alpha.20"
19
20
  },
20
21
  "devDependencies": {
21
22
  "bip39": "3.1.0",
22
23
  "uvu": "^0.5.6",
23
- "@mainsail/crypto-config": "0.0.1-alpha.2",
24
- "@mainsail/crypto-key-pair-ecdsa": "0.0.1-alpha.2",
25
- "@mainsail/crypto-key-pair-schnorr": "0.0.1-alpha.2",
26
- "@mainsail/crypto-validation": "0.0.1-alpha.2",
27
- "@mainsail/validation": "0.0.1-alpha.2"
24
+ "@mainsail/crypto-config": "0.0.1-alpha.20",
25
+ "@mainsail/crypto-key-pair-ecdsa": "0.0.1-alpha.20",
26
+ "@mainsail/crypto-key-pair-schnorr": "0.0.1-alpha.20",
27
+ "@mainsail/validation": "0.0.1-alpha.20",
28
+ "@mainsail/crypto-validation": "0.0.1-alpha.20"
28
29
  },
29
30
  "engines": {
30
31
  "node": ">=20.x"
@@ -34,9 +35,10 @@
34
35
  "build:watch": "pnpm run clean && tsc -w",
35
36
  "clean": "del distribution",
36
37
  "release": "pnpm publish --access public",
37
- "test": "uvu -r tsm source .test.ts",
38
+ "test": "pnpm run uvu source .test.ts",
38
39
  "test:coverage": "c8 pnpm run test",
39
40
  "test:coverage:html": "c8 -r html --all pnpm run test",
40
- "test:file": "uvu -r tsm source"
41
+ "test:file": "pnpm run uvu source",
42
+ "uvu": "tsx --tsconfig ../../tsconfig.test.json ./node_modules/uvu/bin.js"
41
43
  }
42
44
  }