@airgap/astar
Version:
The @airgap/astar is an Astar implementation of the ICoinProtocol interface from @airgap/coinlib-core.
111 lines • 4.17 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createShidenProtocolOptions = exports.SHIDEN_MAINNET_PROTOCOL_NETWORK = exports.createShidenProtocol = exports.ShidenProtocolImpl = exports.SHIDEN_CONFIGURATION = exports.SHIDEN_METADATA = void 0;
var coinlib_core_1 = require("@airgap/coinlib-core");
var AstarBaseProtocol_1 = require("./AstarBaseProtocol");
var AstarProtocol_1 = require("./AstarProtocol");
// Implementation
exports.SHIDEN_METADATA = {
identifier: coinlib_core_1.MainProtocolSymbols.SHIDEN,
name: 'Shiden',
units: {
SDN: {
symbol: { value: 'SDN' },
decimals: 18
},
mSDN: {
symbol: { value: 'mSDN' },
decimals: 15
},
uSDN: {
symbol: { value: 'uSDN' },
decimals: 12
},
nSDN: {
symbol: { value: 'nSDN' },
decimals: 9
},
pSDN: {
symbol: { value: 'pSDN' },
decimals: 6
},
fSDN: {
symbol: { value: 'fSDN' },
decimals: 3
},
aSDN: {
symbol: { value: 'aSDN' },
decimals: 0
}
},
mainUnit: 'SDN',
account: {
standardDerivationPath: "m/44'/810'/0'/0/0",
address: {
isCaseSensitive: true,
placeholder: "ABC...",
regex: '^[a-km-zA-HJ-NP-Z1-9]+$'
}
}
};
exports.SHIDEN_CONFIGURATION = AstarProtocol_1.ASTAR_CONFIGURATION;
var ShidenProtocolImpl = /** @class */ (function (_super) {
__extends(ShidenProtocolImpl, _super);
function ShidenProtocolImpl(options) {
if (options === void 0) { options = {}; }
var completeOptions = createShidenProtocolOptions(options.network);
var metadata = exports.SHIDEN_METADATA;
var configuration = exports.SHIDEN_CONFIGURATION;
return _super.call(this, { metadata: metadata, configuration: configuration, network: completeOptions.network }) || this;
}
return ShidenProtocolImpl;
}(AstarBaseProtocol_1.AstarBaseProtocolImpl));
exports.ShidenProtocolImpl = ShidenProtocolImpl;
// Factory
function createShidenProtocol(options) {
if (options === void 0) { options = {}; }
return new ShidenProtocolImpl(options);
}
exports.createShidenProtocol = createShidenProtocol;
exports.SHIDEN_MAINNET_PROTOCOL_NETWORK = {
name: 'Mainnet',
type: 'mainnet',
rpcUrl: 'https://shiden-node.prod.gke.papers.tech',
blockExplorerUrl: 'https://shiden.subscan.io',
blockExplorerApi: 'https://shiden.subscan.prod.gke.papers.tech/api/v2/scan'
};
var DEFAULT_SHIDEN_PROTOCOL_NETWORK = exports.SHIDEN_MAINNET_PROTOCOL_NETWORK;
function createShidenProtocolOptions(network) {
if (network === void 0) { network = {}; }
return {
network: __assign(__assign({}, DEFAULT_SHIDEN_PROTOCOL_NETWORK), network)
};
}
exports.createShidenProtocolOptions = createShidenProtocolOptions;
//# sourceMappingURL=ShidenProtocol.js.map