@cityofzion/blockchain-service 0.3.2 → 0.4.1

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.
@@ -0,0 +1 @@
1
+ export * from "./keychain";
@@ -0,0 +1,17 @@
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);
@@ -0,0 +1,4 @@
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;
@@ -0,0 +1,34 @@
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();
package/dist/index.d.ts CHANGED
@@ -2,3 +2,4 @@ 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,3 +18,4 @@ __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,6 +8,11 @@ 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
+ };
11
16
  export type CalculateTransferFeeDetails = {
12
17
  systemFee?: string;
13
18
  networkFee?: string;
@@ -25,11 +30,7 @@ export type ClaimResponse = {
25
30
  export interface Claimable {
26
31
  claim(account: Account): Promise<ClaimResponse>;
27
32
  dataService: BlockchainDataService & BDSClaimable;
28
- tokenClaim: {
29
- hash: string;
30
- symbol: string;
31
- decimals: number;
32
- };
33
+ tokenClaim: TokenInfo;
33
34
  }
34
35
  export declare enum NNSRecordTypes {
35
36
  IPV4 = "1",
@@ -59,19 +60,13 @@ export type CalculateTransferFeeResponse = {
59
60
  export interface BlockchainService<BSCustomName extends string = string> {
60
61
  readonly dataService: BlockchainDataService;
61
62
  readonly blockchainName: BSCustomName;
62
- readonly derivationPath: string;
63
- readonly feeToken: {
64
- hash: string;
65
- symbol: string;
66
- decimals: number;
67
- };
63
+ readonly feeToken: TokenInfo;
68
64
  readonly exchange: Exchange;
69
65
  readonly tokens: Token[];
70
66
  sendTransaction(param: SendTransactionParam): Promise<string>;
71
- generateMnemonic(): string;
72
- generateWif(mnemonic: string, index: number): string;
73
- generateAccount(mnemonic: string, index: number): Account;
74
- generateAccountFromWif(wif: string): string;
67
+ generateMnemonic(): string[];
68
+ generateAccount(mnemonic: string[], index: number): Account;
69
+ generateAccountFromWif(wif: string): Account;
75
70
  decryptKey(encryptedKey: string, password: string): Promise<Account>;
76
71
  validateAddress(address: string): boolean;
77
72
  validateEncryptedKey(encryptedKey: string): boolean;
@@ -154,10 +149,10 @@ export interface BlockchainDataService {
154
149
  getAllNodes(): Promise<ConsensusNodeResponse[]>;
155
150
  getHigherNode(): Promise<ConsensusNodeResponse>;
156
151
  }
157
- export type ToeknPricesResponse = {
152
+ export type TokenPricesResponse = {
158
153
  amount: number;
159
154
  Symbol: string;
160
155
  };
161
156
  export interface Exchange {
162
- getTokenPrices(currency: Currency): Promise<ToeknPricesResponse[]>;
157
+ getTokenPrices(currency: Currency): Promise<TokenPricesResponse[]>;
163
158
  }
@@ -0,0 +1,3 @@
1
+ export = SDK;
2
+ export = SDK;
3
+ declare var SDK: any;