@cityofzion/blockchain-service 0.4.1 → 0.7.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.
package/dist/functions.js CHANGED
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isClaimable = exports.hasNNS = void 0;
4
4
  function hasNNS(service) {
5
- return "getNNSRecord" in service && "getOwnerOfNNS" in service && "validateNNSFormat" in service;
5
+ return "getNeoNsRecord" in service && "getOwnerOfNeoNsRecord" in service && "validateNNSDomain" in service;
6
6
  }
7
7
  exports.hasNNS = hasNNS;
8
8
  function isClaimable(service) {
9
- return "claim" in service && "tokenClaim" in service && "getUnclaimed" in service.dataService;
9
+ return "claim" in this && "tokenClaim" in this && "getUnclaimed" in this.dataService;
10
10
  }
11
11
  exports.isClaimable = isClaimable;
package/dist/index.d.ts CHANGED
@@ -2,4 +2,3 @@ export * from './interfaces';
2
2
  export * from './BSAgreggator';
3
3
  export * from './exchanges';
4
4
  export * from "./functions";
5
- export * from "./helpers";
package/dist/index.js CHANGED
@@ -18,4 +18,3 @@ __exportStar(require("./interfaces"), exports);
18
18
  __exportStar(require("./BSAgreggator"), exports);
19
19
  __exportStar(require("./exchanges"), exports);
20
20
  __exportStar(require("./functions"), exports);
21
- __exportStar(require("./helpers"), exports);
@@ -8,11 +8,6 @@ export type IntentTransactionParam = {
8
8
  tokenHash: string;
9
9
  amount: number;
10
10
  };
11
- export type TokenInfo = {
12
- hash: string;
13
- symbol: string;
14
- decimals: number;
15
- };
16
11
  export type CalculateTransferFeeDetails = {
17
12
  systemFee?: string;
18
13
  networkFee?: string;
@@ -30,7 +25,11 @@ export type ClaimResponse = {
30
25
  export interface Claimable {
31
26
  claim(account: Account): Promise<ClaimResponse>;
32
27
  dataService: BlockchainDataService & BDSClaimable;
33
- tokenClaim: TokenInfo;
28
+ tokenClaim: {
29
+ hash: string;
30
+ symbol: string;
31
+ decimals: number;
32
+ };
34
33
  }
35
34
  export declare enum NNSRecordTypes {
36
35
  IPV4 = "1",
@@ -60,13 +59,19 @@ export type CalculateTransferFeeResponse = {
60
59
  export interface BlockchainService<BSCustomName extends string = string> {
61
60
  readonly dataService: BlockchainDataService;
62
61
  readonly blockchainName: BSCustomName;
63
- readonly feeToken: TokenInfo;
62
+ readonly derivationPath: string;
63
+ readonly feeToken: {
64
+ hash: string;
65
+ symbol: string;
66
+ decimals: number;
67
+ };
64
68
  readonly exchange: Exchange;
65
69
  readonly tokens: Token[];
66
70
  sendTransaction(param: SendTransactionParam): Promise<string>;
67
- generateMnemonic(): string[];
68
- generateAccount(mnemonic: string[], index: number): Account;
69
- generateAccountFromWif(wif: string): Account;
71
+ generateMnemonic(): string;
72
+ generateWif(mnemonic: string, index: number): string;
73
+ generateAccount(mnemonic: string, index: number): Account;
74
+ generateAccountFromWif(wif: string): string;
70
75
  decryptKey(encryptedKey: string, password: string): Promise<Account>;
71
76
  validateAddress(address: string): boolean;
72
77
  validateEncryptedKey(encryptedKey: string): boolean;
@@ -149,10 +154,10 @@ export interface BlockchainDataService {
149
154
  getAllNodes(): Promise<ConsensusNodeResponse[]>;
150
155
  getHigherNode(): Promise<ConsensusNodeResponse>;
151
156
  }
152
- export type TokenPricesResponse = {
157
+ export type ToeknPricesResponse = {
153
158
  amount: number;
154
159
  Symbol: string;
155
160
  };
156
161
  export interface Exchange {
157
- getTokenPrices(currency: Currency): Promise<TokenPricesResponse[]>;
162
+ getTokenPrices(currency: Currency): Promise<ToeknPricesResponse[]>;
158
163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/blockchain-service",
3
- "version": "0.4.1",
3
+ "version": "0.7.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",
@@ -12,10 +12,6 @@
12
12
  "scripts": {
13
13
  "build": "tsc && typedoc"
14
14
  },
15
- "dependencies": {
16
- "axios": "1.3.2",
17
- "@moonlight-io/asteroid-sdk-js": "git+https://github.com/Moonlight-io/asteroid-sdk-js"
18
- },
19
15
  "devDependencies": {
20
16
  "@types/node": "~20.2.5",
21
17
  "ts-node": "10.9.1",
@@ -1,4 +0,0 @@
1
- export declare const exception: {
2
- invalidBlockchainService: (message?: string) => never;
3
- blockchainAlreadyExist: (blockchainName: string) => never;
4
- };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.exception = void 0;
4
- exports.exception = {
5
- invalidBlockchainService: (message) => {
6
- throw new Error(`Invalid blockchainServices => ${message}`);
7
- },
8
- blockchainAlreadyExist: (blockchainName) => {
9
- throw new Error(`The blockchain ${blockchainName} already exist`);
10
- }
11
- };
@@ -1 +0,0 @@
1
- export * from "./keychain";
@@ -1,17 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./keychain"), exports);
@@ -1,4 +0,0 @@
1
- import * as AsteroidSDK from '@moonlight-io/asteroid-sdk-js';
2
- declare let SDK: typeof AsteroidSDK;
3
- export { SDK };
4
- export declare const keychain: AsteroidSDK.Keychain;
@@ -1,34 +0,0 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.keychain = exports.SDK = void 0;
27
- const AsteroidSDK = __importStar(require("@moonlight-io/asteroid-sdk-js"));
28
- let SDK = AsteroidSDK;
29
- exports.SDK = SDK;
30
- // @ts-ignore
31
- if (typeof window !== 'undefined') {
32
- exports.SDK = SDK = require('../polyfills/asteroid-sdk');
33
- }
34
- exports.keychain = new SDK.Keychain();
@@ -1,3 +0,0 @@
1
- export = SDK;
2
- export = SDK;
3
- declare var SDK: any;