@wallfree-dev/astar 0.13.42
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/LICENSE.md +7 -0
- package/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +65 -0
- package/readme.md +121 -0
- package/v0/index.d.ts +5 -0
- package/v0/index.js +31 -0
- package/v0/index.js.map +1 -0
- package/v0/protocol/astar/AstarProtocol.d.ts +22 -0
- package/v0/protocol/astar/AstarProtocol.js +79 -0
- package/v0/protocol/astar/AstarProtocol.js.map +1 -0
- package/v0/protocol/astar/AstarProtocolOptions.d.ts +28 -0
- package/v0/protocol/astar/AstarProtocolOptions.js +96 -0
- package/v0/protocol/astar/AstarProtocolOptions.js.map +1 -0
- package/v0/protocol/shiden/ShidenProtocol.d.ts +19 -0
- package/v0/protocol/shiden/ShidenProtocol.js +72 -0
- package/v0/protocol/shiden/ShidenProtocol.js.map +1 -0
- package/v0/protocol/shiden/ShidenProtocolOptions.d.ts +22 -0
- package/v0/protocol/shiden/ShidenProtocolOptions.js +80 -0
- package/v0/protocol/shiden/ShidenProtocolOptions.js.map +1 -0
- package/v1/controller/AstarAccountController.d.ts +5 -0
- package/v1/controller/AstarAccountController.js +28 -0
- package/v1/controller/AstarAccountController.js.map +1 -0
- package/v1/controller/AstarTransactionController.d.ts +5 -0
- package/v1/controller/AstarTransactionController.js +28 -0
- package/v1/controller/AstarTransactionController.js.map +1 -0
- package/v1/index.d.ts +9 -0
- package/v1/index.js +10 -0
- package/v1/index.js.map +1 -0
- package/v1/module/AstarModule.d.ts +19 -0
- package/v1/module/AstarModule.js +113 -0
- package/v1/module/AstarModule.js.map +1 -0
- package/v1/module.d.ts +3 -0
- package/v1/module.js +24 -0
- package/v1/module.js.map +1 -0
- package/v1/node/AstarNodeClient.d.ts +4 -0
- package/v1/node/AstarNodeClient.js +28 -0
- package/v1/node/AstarNodeClient.js.map +1 -0
- package/v1/protocol/AstarBaseProtocol.d.ts +13 -0
- package/v1/protocol/AstarBaseProtocol.js +96 -0
- package/v1/protocol/AstarBaseProtocol.js.map +1 -0
- package/v1/protocol/AstarProtocol.d.ts +14 -0
- package/v1/protocol/AstarProtocol.js +119 -0
- package/v1/protocol/AstarProtocol.js.map +1 -0
- package/v1/protocol/ShidenProtocol.d.ts +14 -0
- package/v1/protocol/ShidenProtocol.js +111 -0
- package/v1/protocol/ShidenProtocol.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +7 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +21 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-astar.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-astar.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-astar.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-astar.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-astar.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-astar.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-astar.json +36 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-astar.json +19 -0
- package/v1/serializer/v3/serializer-companion.d.ts +14 -0
- package/v1/serializer/v3/serializer-companion.js +189 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validator.d.ts +4 -0
- package/v1/serializer/v3/validators/transaction-validator.js +28 -0
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
- package/v1/serializer/v3/validators/validators.d.ts +4 -0
- package/v1/serializer/v3/validators/validators.js +6 -0
- package/v1/serializer/v3/validators/validators.js.map +1 -0
- package/v1/types/configuration.d.ts +4 -0
- package/v1/types/configuration.js +3 -0
- package/v1/types/configuration.js.map +1 -0
- package/v1/types/crypto.d.ts +2 -0
- package/v1/types/crypto.js +3 -0
- package/v1/types/crypto.js.map +1 -0
- package/v1/types/protocol.d.ts +12 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2019 Papers AG
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './v1';
|
package/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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("./v1"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAoB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wallfree-dev/astar",
|
|
3
|
+
"version": "0.13.42",
|
|
4
|
+
"description": "The @wallfree-dev/astar is an Astar implementation of the ICoinProtocol interface from @wallfree-dev/coinlib-core.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"airgap",
|
|
7
|
+
"blockchain",
|
|
8
|
+
"crypto",
|
|
9
|
+
"substrate",
|
|
10
|
+
"astar",
|
|
11
|
+
"shiden"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"homepage": "https://www.airgap.it",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/airgap-it/airgap-coin-lib"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "rm -rf ./dist && tsc && node scripts/copy-files-after-build.js",
|
|
24
|
+
"build-scripts": "tsc scripts/copy-files-after-build.ts",
|
|
25
|
+
"lint": "tslint -c ./tslint.json --project ./tsconfig.json --format stylish --fix",
|
|
26
|
+
"lint:prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
27
|
+
"lint-ci": "tslint -t json -o ../../lint-reports/astar.json --project . || true",
|
|
28
|
+
"lint-ci:prettier": "prettier \"src/**/*.ts\" \"test/**/*.ts\" --list-different",
|
|
29
|
+
"test": "TS_NODE_PROJECT='./test/tsconfig.json' nyc mocha --bail --require ts-node/register --require tsconfig-paths/register --require source-map-support/register --full-trace --delay --timeout 40000 ./test/**/**.spec.ts",
|
|
30
|
+
"test-ci": "nyc --reporter=lcov pnpm test",
|
|
31
|
+
"browserify": "browserify ./dist/index.js -s airgapCoinLibAstar > ./dist/airgap-coinlib-astar.min.js"
|
|
32
|
+
},
|
|
33
|
+
"author": "Papers AG <contact@papers.ch> (https://papers.ch)",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@wallfree-dev/coinlib-core": "^0.13.42",
|
|
36
|
+
"@wallfree-dev/module-kit": "^0.13.42",
|
|
37
|
+
"@wallfree-dev/serializer": "^0.13.42",
|
|
38
|
+
"@wallfree-dev/substrate": "^0.13.42",
|
|
39
|
+
"@polkadot/util": "2.0.1",
|
|
40
|
+
"@polkadot/wasm-crypto": "0.20.1"
|
|
41
|
+
},
|
|
42
|
+
"localDependencies": {},
|
|
43
|
+
"nyc": {
|
|
44
|
+
"include": [
|
|
45
|
+
"src/**/*.ts"
|
|
46
|
+
],
|
|
47
|
+
"exclude": [
|
|
48
|
+
"test/**/*.spec.ts"
|
|
49
|
+
],
|
|
50
|
+
"extension": [
|
|
51
|
+
".ts"
|
|
52
|
+
],
|
|
53
|
+
"require": [
|
|
54
|
+
"ts-node/register"
|
|
55
|
+
],
|
|
56
|
+
"reporter": [
|
|
57
|
+
"text",
|
|
58
|
+
"text-summary"
|
|
59
|
+
],
|
|
60
|
+
"report-dir": "../../coverage/astar",
|
|
61
|
+
"sourceMap": true,
|
|
62
|
+
"instrument": true
|
|
63
|
+
},
|
|
64
|
+
"gitHead": "8e8feb6788204501b7173aa825f5456c2a5f185b"
|
|
65
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# AirGap Coin Library
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/airgap-coin-lib)
|
|
4
|
+
[](https://airgap-it.github.io/airgap-coin-lib/)
|
|
5
|
+
[](https://travis-ci.org/airgap-it/airgap-coin-lib/)
|
|
6
|
+
[](https://codecov.io/gh/airgap-it/airgap-coin-lib/)
|
|
7
|
+
|
|
8
|
+
The `airgap-coin-lib` is a protocol-agnostic library that allows easy handling of the most important tasks relating cryptocurrencies and blockchains.
|
|
9
|
+
|
|
10
|
+
It implements operations such as preparing, signing and broadcasting transactions for a range of protocols.
|
|
11
|
+
|
|
12
|
+
The library consists of a shared interface for all implemented protocols. This is especially useful in the context of AirGap because methods are designed to support offline key management and signing. The following core operations are specified:
|
|
13
|
+
|
|
14
|
+
- `prepareTransaction` - This is done on AirGap Wallet (online) side. Either a public key or extended public key is used and will fetch the required information from the network.
|
|
15
|
+
- `signTransaction` - This is done in AirGap Vault (offline) side. The output of "prepareTransaction" is the input for this method (hence the output of "prepareTransaction" is transferred via URL scheme (same-device) or QR code (2-device-setup)).
|
|
16
|
+
- `broadcastTransaction` - This is done in AirGap Wallet (online) side. The output of "signTransaction" is the input for this method (hence the output of "signTransaction" is transferred via URL scheme (same-device) or QR code (2-device-setup)).
|
|
17
|
+
|
|
18
|
+
## Supported Protocols
|
|
19
|
+
|
|
20
|
+
The modular design used in this library allows you to simply add new protocols with special logic. Adding a new Bitcoin-like protocol basically means:
|
|
21
|
+
|
|
22
|
+
1. select the correct network parameters (see `src/networks.ts`)
|
|
23
|
+
2. set the Insight API URL to communicate with the blockchain
|
|
24
|
+
|
|
25
|
+
Adding a new Ethereum-like protocol means:
|
|
26
|
+
|
|
27
|
+
1. set the correct chain id
|
|
28
|
+
2. set the JSON RPC URL
|
|
29
|
+
|
|
30
|
+
Currently supported are:
|
|
31
|
+
|
|
32
|
+
- Bitcoin
|
|
33
|
+
- Ethereum
|
|
34
|
+
- Generic ERC20 Tokens
|
|
35
|
+
- Aeternity
|
|
36
|
+
- Tezos
|
|
37
|
+
- FA1.2 tokens
|
|
38
|
+
- tzBTC
|
|
39
|
+
- USDtz
|
|
40
|
+
- FA2 tokens
|
|
41
|
+
- Groestlcoin
|
|
42
|
+
- Cosmos
|
|
43
|
+
- Polkadot
|
|
44
|
+
- Kusama
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
### Protocols
|
|
49
|
+
|
|
50
|
+
The way the interface was designed is to allow stateless calls. This means the class stores very little state itself.
|
|
51
|
+
All required input comes from the method params (public key, extended public key, etc...)
|
|
52
|
+
|
|
53
|
+
Currently we support for Bitcoin-like (UTXO) protocols:
|
|
54
|
+
|
|
55
|
+
- Single Address Wallets (deprecated)
|
|
56
|
+
- HD Wallets
|
|
57
|
+
|
|
58
|
+
Currently we support for Ethereum-like (Account-based) protocols:
|
|
59
|
+
|
|
60
|
+
- Single Address Wallets
|
|
61
|
+
|
|
62
|
+
### Delegation
|
|
63
|
+
|
|
64
|
+
There is a different interface that can be implemented if the protocol supports delegation. The delegation flow usually requires some changes in the user interface of the AirGap Wallet as well.
|
|
65
|
+
|
|
66
|
+
### Inter App Communication
|
|
67
|
+
|
|
68
|
+
A serializer is included that encodes JSON structures with RLP and base58check. Those strings can then be sent to the other app, either through QR codes or a URL. The serializer can only serialize messages in predefined formats, so new message types have to be added when new protocols are added.
|
|
69
|
+
|
|
70
|
+
### Tezos FA1.2 and FA2 tokens
|
|
71
|
+
|
|
72
|
+
It is possible to interact (fetch balances, create transfers, etc.) with an FA1.2 and FA2 smart contracts using the `TezosFA12Protocol` and `TezosFA2Protocol` classes. An example on how to use them can be found in `examples/custom/protocols/tezos/fa2-smart-contract.ts`.
|
|
73
|
+
|
|
74
|
+
## Synchronising information between wallet and vault
|
|
75
|
+
|
|
76
|
+
Such that the system works we need to be able to synchronise wallets. A wallet can be:
|
|
77
|
+
|
|
78
|
+
- Single Address Wallet
|
|
79
|
+
- HD Wallet
|
|
80
|
+
|
|
81
|
+
For the single address wallet we only need to share the public key. For HD Wallet we need to share the extended public key.
|
|
82
|
+
|
|
83
|
+
## Getting started
|
|
84
|
+
|
|
85
|
+
### Requirements
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
npm >= 6
|
|
89
|
+
NodeJS >= 12
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Build dependencies get installed using `npm install`.
|
|
93
|
+
|
|
94
|
+
### Clone and Run
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
$ git clone https://github.com/airgap-it/airgap-coin-lib.git
|
|
98
|
+
$ cd airgap-coin-lib
|
|
99
|
+
$ npm install
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
To run the tests, you will have to install the test dependencies
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
$ npm run install-test-dependencies
|
|
106
|
+
$ npm test
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
To remove the test dependencies and clean up the `package.json` and `package-lock.json`, execute this command
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
$ npm run install-build-dependencies
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Contributing
|
|
116
|
+
|
|
117
|
+
We welcome contributions from the community. Simple readme updates or bugfixes can be addressed with a PR directly.
|
|
118
|
+
|
|
119
|
+
For larger changes like new protocols, new features or larger refactorings, please contact us first by opening an issue. This project is under constant development and until version `1.x.x` has been reached, there will be frequent breaking changes. So make sure to take a look at the `develop` branch.
|
|
120
|
+
|
|
121
|
+
Regarding new protocols / currencies, we cannot guarantee that they will be merged, but we're more than happy to discuss the details of a specific integration in a github issue.
|
package/v0/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AstarProtocol } from './protocol/astar/AstarProtocol';
|
|
2
|
+
import { AstarProtocolConfig, AstarProtocolNetwork, AstarProtocolNetworkExtras, AstarProtocolOptions, AstarSubscanBlockExplorer } from './protocol/astar/AstarProtocolOptions';
|
|
3
|
+
import { ShidenProtocol } from './protocol/shiden/ShidenProtocol';
|
|
4
|
+
import { ShidenProtocolConfig, ShidenProtocolNetwork, ShidenProtocolNetworkExtras, ShidenProtocolOptions, ShidenSubscanBlockExplorer } from './protocol/shiden/ShidenProtocolOptions';
|
|
5
|
+
export { AstarProtocol, AstarProtocolNetworkExtras, AstarSubscanBlockExplorer, AstarProtocolConfig, AstarProtocolNetwork, AstarProtocolOptions, ShidenProtocol, ShidenProtocolNetworkExtras, ShidenSubscanBlockExplorer, ShidenProtocolConfig, ShidenProtocolNetwork, ShidenProtocolOptions };
|
package/v0/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShidenProtocolOptions = exports.ShidenProtocolNetwork = exports.ShidenProtocolConfig = exports.ShidenSubscanBlockExplorer = exports.ShidenProtocolNetworkExtras = exports.ShidenProtocol = exports.AstarProtocolOptions = exports.AstarProtocolNetwork = exports.AstarProtocolConfig = exports.AstarSubscanBlockExplorer = exports.AstarProtocolNetworkExtras = exports.AstarProtocol = void 0;
|
|
4
|
+
var coinlib_core_1 = require("@wallfree-dev/coinlib-core");
|
|
5
|
+
var serializer_1 = require("@wallfree-dev/serializer");
|
|
6
|
+
var AstarProtocol_1 = require("./protocol/astar/AstarProtocol");
|
|
7
|
+
Object.defineProperty(exports, "AstarProtocol", { enumerable: true, get: function () { return AstarProtocol_1.AstarProtocol; } });
|
|
8
|
+
var AstarProtocolOptions_1 = require("./protocol/astar/AstarProtocolOptions");
|
|
9
|
+
Object.defineProperty(exports, "AstarProtocolConfig", { enumerable: true, get: function () { return AstarProtocolOptions_1.AstarProtocolConfig; } });
|
|
10
|
+
Object.defineProperty(exports, "AstarProtocolNetwork", { enumerable: true, get: function () { return AstarProtocolOptions_1.AstarProtocolNetwork; } });
|
|
11
|
+
Object.defineProperty(exports, "AstarProtocolNetworkExtras", { enumerable: true, get: function () { return AstarProtocolOptions_1.AstarProtocolNetworkExtras; } });
|
|
12
|
+
Object.defineProperty(exports, "AstarProtocolOptions", { enumerable: true, get: function () { return AstarProtocolOptions_1.AstarProtocolOptions; } });
|
|
13
|
+
Object.defineProperty(exports, "AstarSubscanBlockExplorer", { enumerable: true, get: function () { return AstarProtocolOptions_1.AstarSubscanBlockExplorer; } });
|
|
14
|
+
var ShidenProtocol_1 = require("./protocol/shiden/ShidenProtocol");
|
|
15
|
+
Object.defineProperty(exports, "ShidenProtocol", { enumerable: true, get: function () { return ShidenProtocol_1.ShidenProtocol; } });
|
|
16
|
+
var ShidenProtocolOptions_1 = require("./protocol/shiden/ShidenProtocolOptions");
|
|
17
|
+
Object.defineProperty(exports, "ShidenProtocolConfig", { enumerable: true, get: function () { return ShidenProtocolOptions_1.ShidenProtocolConfig; } });
|
|
18
|
+
Object.defineProperty(exports, "ShidenProtocolNetwork", { enumerable: true, get: function () { return ShidenProtocolOptions_1.ShidenProtocolNetwork; } });
|
|
19
|
+
Object.defineProperty(exports, "ShidenProtocolNetworkExtras", { enumerable: true, get: function () { return ShidenProtocolOptions_1.ShidenProtocolNetworkExtras; } });
|
|
20
|
+
Object.defineProperty(exports, "ShidenProtocolOptions", { enumerable: true, get: function () { return ShidenProtocolOptions_1.ShidenProtocolOptions; } });
|
|
21
|
+
Object.defineProperty(exports, "ShidenSubscanBlockExplorer", { enumerable: true, get: function () { return ShidenProtocolOptions_1.ShidenSubscanBlockExplorer; } });
|
|
22
|
+
// Serializer
|
|
23
|
+
serializer_1.Serializer.addSchema(serializer_1.IACMessageType.TransactionSignRequest, { schema: require('@wallfree-dev/substrate/v0/serializer/schemas/v2/transaction-sign-request-substrate.json') }, coinlib_core_1.MainProtocolSymbols.ASTAR);
|
|
24
|
+
serializer_1.Serializer.addSchema(serializer_1.IACMessageType.TransactionSignResponse, { schema: require('@wallfree-dev/substrate/v0/serializer/schemas/v2/transaction-sign-response-substrate.json') }, coinlib_core_1.MainProtocolSymbols.ASTAR);
|
|
25
|
+
serializer_1.SerializerV3.addSchema(serializer_1.IACMessageType.TransactionSignRequest, { schema: require('@wallfree-dev/substrate/v0/serializer/schemas/v3/transaction-sign-request-substrate.json') }, coinlib_core_1.MainProtocolSymbols.ASTAR);
|
|
26
|
+
serializer_1.SerializerV3.addSchema(serializer_1.IACMessageType.TransactionSignResponse, { schema: require('@wallfree-dev/substrate/v0/serializer/schemas/v3/transaction-sign-response-substrate.json') }, coinlib_core_1.MainProtocolSymbols.ASTAR);
|
|
27
|
+
serializer_1.Serializer.addSchema(serializer_1.IACMessageType.TransactionSignRequest, { schema: require('@wallfree-dev/substrate/v0/serializer/schemas/v2/transaction-sign-request-substrate.json') }, coinlib_core_1.MainProtocolSymbols.SHIDEN);
|
|
28
|
+
serializer_1.Serializer.addSchema(serializer_1.IACMessageType.TransactionSignResponse, { schema: require('@wallfree-dev/substrate/v0/serializer/schemas/v2/transaction-sign-response-substrate.json') }, coinlib_core_1.MainProtocolSymbols.SHIDEN);
|
|
29
|
+
serializer_1.SerializerV3.addSchema(serializer_1.IACMessageType.TransactionSignRequest, { schema: require('@wallfree-dev/substrate/v0/serializer/schemas/v3/transaction-sign-request-substrate.json') }, coinlib_core_1.MainProtocolSymbols.SHIDEN);
|
|
30
|
+
serializer_1.SerializerV3.addSchema(serializer_1.IACMessageType.TransactionSignResponse, { schema: require('@wallfree-dev/substrate/v0/serializer/schemas/v3/transaction-sign-response-substrate.json') }, coinlib_core_1.MainProtocolSymbols.SHIDEN);
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
package/v0/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v0/index.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAChE,uDAAmF;AAEnF,gEAA8D;AAkB5D,8FAlBO,6BAAa,OAkBP;AAjBf,8EAM8C;AAc5C,oGAnBA,0CA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MAAM,CAC3B,CAAA;AAED,yBAAY,CAAC,SAAS,CACpB,2BAAc,CAAC,sBAAsB,EACrC,EAAE,MAAM,EAAE,OAAO,CAAC,0FAA0F,CAAC,EAAE,EAC/G,kCAAmB,CAAC,MAAM,CAC3B,CAAA;AACD,yBAAY,CAAC,SAAS,CACpB,2BAAc,CAAC,uBAAuB,EACtC,EAAE,MAAM,EAAE,OAAO,CAAC,2FAA2F,CAAC,EAAE,EAChH,kCAAmB,CAAC,MAAM,CAC3B,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CurrencyUnit, FeeDefaults } from '@wallfree-dev/coinlib-core/protocols/ICoinProtocol';
|
|
2
|
+
import { ProtocolSymbols } from '@wallfree-dev/coinlib-core/utils/ProtocolSymbols';
|
|
3
|
+
import { SubstrateDelegateProtocol } from '@wallfree-dev/substrate/v0/protocol/SubstrateDelegateProtocol';
|
|
4
|
+
import { SubstrateNetwork } from '@wallfree-dev/substrate/v0/protocol/SubstrateNetwork';
|
|
5
|
+
import { SubstrateProtocolOptions } from '@wallfree-dev/substrate/v0/protocol/SubstrateProtocolOptions';
|
|
6
|
+
export declare class AstarProtocol extends SubstrateDelegateProtocol<SubstrateNetwork.ASTAR> {
|
|
7
|
+
readonly options: SubstrateProtocolOptions<SubstrateNetwork.ASTAR>;
|
|
8
|
+
symbol: string;
|
|
9
|
+
name: string;
|
|
10
|
+
marketSymbol: string;
|
|
11
|
+
feeSymbol: string;
|
|
12
|
+
decimals: number;
|
|
13
|
+
feeDecimals: number;
|
|
14
|
+
identifier: ProtocolSymbols;
|
|
15
|
+
feeDefaults: FeeDefaults;
|
|
16
|
+
units: CurrencyUnit[];
|
|
17
|
+
standardDerivationPath: string;
|
|
18
|
+
addressIsCaseSensitive: boolean;
|
|
19
|
+
addressValidationPattern: string;
|
|
20
|
+
addressPlaceholder: string;
|
|
21
|
+
constructor(options?: SubstrateProtocolOptions<SubstrateNetwork.ASTAR>);
|
|
22
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.AstarProtocol = void 0;
|
|
19
|
+
var ProtocolSymbols_1 = require("@wallfree-dev/coinlib-core/utils/ProtocolSymbols");
|
|
20
|
+
var SubstrateDelegateProtocol_1 = require("@wallfree-dev/substrate/v0/protocol/SubstrateDelegateProtocol");
|
|
21
|
+
var AstarProtocolOptions_1 = require("./AstarProtocolOptions");
|
|
22
|
+
var AstarProtocol = /** @class */ (function (_super) {
|
|
23
|
+
__extends(AstarProtocol, _super);
|
|
24
|
+
function AstarProtocol(options) {
|
|
25
|
+
if (options === void 0) { options = new AstarProtocolOptions_1.AstarProtocolOptions(); }
|
|
26
|
+
var _this = _super.call(this, options) || this;
|
|
27
|
+
_this.options = options;
|
|
28
|
+
_this.symbol = 'ASTR';
|
|
29
|
+
_this.name = 'Astar';
|
|
30
|
+
_this.marketSymbol = 'ASTR';
|
|
31
|
+
_this.feeSymbol = 'ASTR';
|
|
32
|
+
_this.decimals = 18;
|
|
33
|
+
_this.feeDecimals = 18;
|
|
34
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.ASTAR;
|
|
35
|
+
_this.feeDefaults = {
|
|
36
|
+
low: '0.001',
|
|
37
|
+
medium: '0.001',
|
|
38
|
+
high: '0.001'
|
|
39
|
+
};
|
|
40
|
+
_this.units = [
|
|
41
|
+
{
|
|
42
|
+
unitSymbol: 'ASTR',
|
|
43
|
+
factor: '1'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
unitSymbol: 'mASTR',
|
|
47
|
+
factor: '0.001'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
unitSymbol: 'uASTR',
|
|
51
|
+
factor: '0.000001'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
unitSymbol: 'nASTR',
|
|
55
|
+
factor: '0.000000001'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
unitSymbol: 'pASTR',
|
|
59
|
+
factor: '0.000000000001'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
unitSymbol: 'fASTR',
|
|
63
|
+
factor: '0.000000000000001'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
unitSymbol: 'aASTR',
|
|
67
|
+
factor: '0.000000000000000001'
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
_this.standardDerivationPath = "m/44'/810'/0'/0/0";
|
|
71
|
+
_this.addressIsCaseSensitive = true;
|
|
72
|
+
_this.addressValidationPattern = '^[a-km-zA-HJ-NP-Z1-9]+$';
|
|
73
|
+
_this.addressPlaceholder = "ABC...";
|
|
74
|
+
return _this;
|
|
75
|
+
}
|
|
76
|
+
return AstarProtocol;
|
|
77
|
+
}(SubstrateDelegateProtocol_1.SubstrateDelegateProtocol));
|
|
78
|
+
exports.AstarProtocol = AstarProtocol;
|
|
79
|
+
//# sourceMappingURL=AstarProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstarProtocol.js","sourceRoot":"","sources":["../../../../src/v0/protocol/astar/AstarProtocol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,qDAAyB,GAwD3D;AAxDY,sCAAa"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ProtocolBlockExplorer } from '@wallfree-dev/coinlib-core/utils/ProtocolBlockExplorer';
|
|
2
|
+
import { NetworkType, ProtocolNetwork } from '@wallfree-dev/coinlib-core/utils/ProtocolNetwork';
|
|
3
|
+
import { SubstrateNodeClient } from '@wallfree-dev/substrate/v0/protocol/common/node/SubstrateNodeClient';
|
|
4
|
+
import { SubstrateNetwork } from '@wallfree-dev/substrate/v0/protocol/SubstrateNetwork';
|
|
5
|
+
import { SubscanBlockExplorer, SubstrateProtocolConfig, SubstrateProtocolNetworkExtras, SubstrateProtocolOptions } from '@wallfree-dev/substrate/v0/protocol/SubstrateProtocolOptions';
|
|
6
|
+
export declare class AstarProtocolConfig extends SubstrateProtocolConfig {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
export declare class AstarSubscanBlockExplorer extends SubscanBlockExplorer {
|
|
10
|
+
constructor(blockExplorer?: string);
|
|
11
|
+
}
|
|
12
|
+
export declare class AstarProtocolNetworkExtras extends SubstrateProtocolNetworkExtras<SubstrateNetwork.ASTAR> {
|
|
13
|
+
readonly apiUrl: string;
|
|
14
|
+
constructor(apiUrl?: string);
|
|
15
|
+
}
|
|
16
|
+
export declare class AstarProtocolNetwork extends ProtocolNetwork<AstarProtocolNetworkExtras> {
|
|
17
|
+
constructor(name?: string, type?: NetworkType, rpcUrl?: string, blockExplorer?: ProtocolBlockExplorer, extras?: AstarProtocolNetworkExtras);
|
|
18
|
+
}
|
|
19
|
+
export declare class BaseAstarProtocolOptions<Config extends AstarProtocolConfig = AstarProtocolConfig> extends SubstrateProtocolOptions<SubstrateNetwork.ASTAR, Config> {
|
|
20
|
+
readonly network: AstarProtocolNetwork;
|
|
21
|
+
readonly config: Config;
|
|
22
|
+
constructor(network: AstarProtocolNetwork, config: Config, nodeClient?: SubstrateNodeClient<SubstrateNetwork.ASTAR>);
|
|
23
|
+
}
|
|
24
|
+
export declare class AstarProtocolOptions extends BaseAstarProtocolOptions {
|
|
25
|
+
readonly network: AstarProtocolNetwork;
|
|
26
|
+
readonly config: AstarProtocolConfig;
|
|
27
|
+
constructor(network?: AstarProtocolNetwork, config?: AstarProtocolConfig);
|
|
28
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// tslint:disable:max-classes-per-file
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.AstarProtocolOptions = exports.BaseAstarProtocolOptions = exports.AstarProtocolNetwork = exports.AstarProtocolNetworkExtras = exports.AstarSubscanBlockExplorer = exports.AstarProtocolConfig = void 0;
|
|
20
|
+
var ProtocolNetwork_1 = require("@wallfree-dev/coinlib-core/utils/ProtocolNetwork");
|
|
21
|
+
var SubstrateNodeClient_1 = require("@wallfree-dev/substrate/v0/protocol/common/node/SubstrateNodeClient");
|
|
22
|
+
var SubstrateAccountController_1 = require("@wallfree-dev/substrate/v0/protocol/common/SubstrateAccountController");
|
|
23
|
+
var SubstrateTransactionController_1 = require("@wallfree-dev/substrate/v0/protocol/common/SubstrateTransactionController");
|
|
24
|
+
var SubstrateNetwork_1 = require("@wallfree-dev/substrate/v0/protocol/SubstrateNetwork");
|
|
25
|
+
var SubstrateProtocolOptions_1 = require("@wallfree-dev/substrate/v0/protocol/SubstrateProtocolOptions");
|
|
26
|
+
var MAINNET_NAME = 'Mainnet';
|
|
27
|
+
var NODE_URL = 'https://evm.astar.network';
|
|
28
|
+
var BLOCK_EXPLORER_URL = 'https://astar.subscan.io';
|
|
29
|
+
var BLOCK_EXPLORER_API = 'https://astar.subscan.prod.gke.papers.tech/api/scan';
|
|
30
|
+
var AstarProtocolConfig = /** @class */ (function (_super) {
|
|
31
|
+
__extends(AstarProtocolConfig, _super);
|
|
32
|
+
function AstarProtocolConfig() {
|
|
33
|
+
return _super.call(this) || this;
|
|
34
|
+
}
|
|
35
|
+
return AstarProtocolConfig;
|
|
36
|
+
}(SubstrateProtocolOptions_1.SubstrateProtocolConfig));
|
|
37
|
+
exports.AstarProtocolConfig = AstarProtocolConfig;
|
|
38
|
+
var AstarSubscanBlockExplorer = /** @class */ (function (_super) {
|
|
39
|
+
__extends(AstarSubscanBlockExplorer, _super);
|
|
40
|
+
function AstarSubscanBlockExplorer(blockExplorer) {
|
|
41
|
+
if (blockExplorer === void 0) { blockExplorer = BLOCK_EXPLORER_URL; }
|
|
42
|
+
return _super.call(this, blockExplorer) || this;
|
|
43
|
+
}
|
|
44
|
+
return AstarSubscanBlockExplorer;
|
|
45
|
+
}(SubstrateProtocolOptions_1.SubscanBlockExplorer));
|
|
46
|
+
exports.AstarSubscanBlockExplorer = AstarSubscanBlockExplorer;
|
|
47
|
+
var AstarProtocolNetworkExtras = /** @class */ (function (_super) {
|
|
48
|
+
__extends(AstarProtocolNetworkExtras, _super);
|
|
49
|
+
function AstarProtocolNetworkExtras(apiUrl) {
|
|
50
|
+
if (apiUrl === void 0) { apiUrl = BLOCK_EXPLORER_API; }
|
|
51
|
+
var _this = _super.call(this, apiUrl, SubstrateNetwork_1.SubstrateNetwork.ASTAR) || this;
|
|
52
|
+
_this.apiUrl = apiUrl;
|
|
53
|
+
return _this;
|
|
54
|
+
}
|
|
55
|
+
return AstarProtocolNetworkExtras;
|
|
56
|
+
}(SubstrateProtocolOptions_1.SubstrateProtocolNetworkExtras));
|
|
57
|
+
exports.AstarProtocolNetworkExtras = AstarProtocolNetworkExtras;
|
|
58
|
+
var AstarProtocolNetwork = /** @class */ (function (_super) {
|
|
59
|
+
__extends(AstarProtocolNetwork, _super);
|
|
60
|
+
function AstarProtocolNetwork(name, type, rpcUrl, blockExplorer, extras) {
|
|
61
|
+
if (name === void 0) { name = MAINNET_NAME; }
|
|
62
|
+
if (type === void 0) { type = ProtocolNetwork_1.NetworkType.MAINNET; }
|
|
63
|
+
if (rpcUrl === void 0) { rpcUrl = NODE_URL; }
|
|
64
|
+
if (blockExplorer === void 0) { blockExplorer = new AstarSubscanBlockExplorer(); }
|
|
65
|
+
if (extras === void 0) { extras = new AstarProtocolNetworkExtras(); }
|
|
66
|
+
return _super.call(this, name, type, rpcUrl, blockExplorer, extras) || this;
|
|
67
|
+
}
|
|
68
|
+
return AstarProtocolNetwork;
|
|
69
|
+
}(ProtocolNetwork_1.ProtocolNetwork));
|
|
70
|
+
exports.AstarProtocolNetwork = AstarProtocolNetwork;
|
|
71
|
+
var BaseAstarProtocolOptions = /** @class */ (function (_super) {
|
|
72
|
+
__extends(BaseAstarProtocolOptions, _super);
|
|
73
|
+
function BaseAstarProtocolOptions(network, config, nodeClient) {
|
|
74
|
+
if (nodeClient === void 0) { nodeClient = new SubstrateNodeClient_1.SubstrateNodeClient(network.extras.network, network.rpcUrl); }
|
|
75
|
+
var _this = _super.call(this, network, config, nodeClient, new SubstrateAccountController_1.SubstrateAccountController(network.extras.network, nodeClient), new SubstrateTransactionController_1.SubstrateTransactionController(network.extras.network, nodeClient)) || this;
|
|
76
|
+
_this.network = network;
|
|
77
|
+
_this.config = config;
|
|
78
|
+
return _this;
|
|
79
|
+
}
|
|
80
|
+
return BaseAstarProtocolOptions;
|
|
81
|
+
}(SubstrateProtocolOptions_1.SubstrateProtocolOptions));
|
|
82
|
+
exports.BaseAstarProtocolOptions = BaseAstarProtocolOptions;
|
|
83
|
+
var AstarProtocolOptions = /** @class */ (function (_super) {
|
|
84
|
+
__extends(AstarProtocolOptions, _super);
|
|
85
|
+
function AstarProtocolOptions(network, config) {
|
|
86
|
+
if (network === void 0) { network = new AstarProtocolNetwork(); }
|
|
87
|
+
if (config === void 0) { config = new AstarProtocolConfig(); }
|
|
88
|
+
var _this = _super.call(this, network, config) || this;
|
|
89
|
+
_this.network = network;
|
|
90
|
+
_this.config = config;
|
|
91
|
+
return _this;
|
|
92
|
+
}
|
|
93
|
+
return AstarProtocolOptions;
|
|
94
|
+
}(BaseAstarProtocolOptions));
|
|
95
|
+
exports.AstarProtocolOptions = AstarProtocolOptions;
|
|
96
|
+
//# sourceMappingURL=AstarProtocolOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstarProtocolOptions.js","sourceRoot":"","sources":["../../../../src/v0/protocol/astar/AstarProtocolOptions.ts"],"names":[],"mappings":";AAAA,sCAAsC;;;;;;;;;;;;;;;;;;AAGtC,oFAA+F;AAC/F,2GAAyG;AACzG,oHAAkH;AAClH,4HAA0H;AAC1H,yFAAuF;AACvF,yGAKqE;AAErE,IAAM,YAAY,GAAW,SAAS,CAAA;AAEtC,IAAM,QAAQ,GAAW,2BAA2B,CAAA;AAEpD,IAAM,kBAAkB,GAAW,0BAA0B,CAAA;AAC7D,IAAM,kBAAkB,GAAW,qDAAqD,CAAA;AAExF;IAAyC,uCAAuB;IAC9D;eACE,iBAAO;IACT,CAAC;IACH,0BAAC;AAAD,CAAC,AAJD,CAAyC,kDAAuB,GAI/D;AAJY,kDAAmB;AAMhC;IAA+C,6CAAoB;IACjE,mCAAY,aAA0C;QAA1C,8BAAA,EAAA,kCAA0C;eACpD,kBAAM,aAAa,CAAC;IACtB,CAAC;IACH,gCAAC;AAAD,CAA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AwB,GAiB/H;AAjBY,4DAAwB;AAmBrC;IAA0C,wCAAwB;IAChE,8BACkB,OAA0D,EAC1D,MAAuD;QADvD,wBAAA,EAAA,cAAoC,oBAAoB,EAAE;QAC1D,uBAAA,EAAA,aAAkC,mBAAmB,EAAE;QAFzE,YAIE,kBAAM,OAAO,EAAE,MAAM,CAAC,SACvB;QAJiB,aAAO,GAAP,OAAO,CAAmD;QAC1D,YAAM,GAAN,MAAM,CAAiD;;IAGzE,CAAC;IACH,2BAAC;AAAD,CAAC,AAPD,CAA0C,wBAAwB,GAOjE;AAPY,oDAAoB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CurrencyUnit } from '@wallfree-dev/coinlib-core/protocols/ICoinProtocol';
|
|
2
|
+
import { ProtocolSymbols } from '@wallfree-dev/coinlib-core/utils/ProtocolSymbols';
|
|
3
|
+
import { SubstrateNetwork } from '@wallfree-dev/substrate/v0/protocol/SubstrateNetwork';
|
|
4
|
+
import { SubstrateProtocolOptions } from '@wallfree-dev/substrate/v0/protocol/SubstrateProtocolOptions';
|
|
5
|
+
import { AstarProtocol } from '../astar/AstarProtocol';
|
|
6
|
+
export declare class ShidenProtocol extends AstarProtocol {
|
|
7
|
+
readonly options: SubstrateProtocolOptions<SubstrateNetwork.ASTAR>;
|
|
8
|
+
symbol: string;
|
|
9
|
+
name: string;
|
|
10
|
+
marketSymbol: string;
|
|
11
|
+
feeSymbol: string;
|
|
12
|
+
identifier: ProtocolSymbols;
|
|
13
|
+
units: CurrencyUnit[];
|
|
14
|
+
standardDerivationPath: string;
|
|
15
|
+
addressIsCaseSensitive: boolean;
|
|
16
|
+
addressValidationPattern: string;
|
|
17
|
+
addressPlaceholder: string;
|
|
18
|
+
constructor(options?: SubstrateProtocolOptions<SubstrateNetwork.ASTAR>);
|
|
19
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ShidenProtocol = void 0;
|
|
19
|
+
var ProtocolSymbols_1 = require("@wallfree-dev/coinlib-core/utils/ProtocolSymbols");
|
|
20
|
+
var AstarProtocol_1 = require("../astar/AstarProtocol");
|
|
21
|
+
var ShidenProtocolOptions_1 = require("./ShidenProtocolOptions");
|
|
22
|
+
var ShidenProtocol = /** @class */ (function (_super) {
|
|
23
|
+
__extends(ShidenProtocol, _super);
|
|
24
|
+
function ShidenProtocol(options) {
|
|
25
|
+
if (options === void 0) { options = new ShidenProtocolOptions_1.ShidenProtocolOptions(); }
|
|
26
|
+
var _this = _super.call(this, options) || this;
|
|
27
|
+
_this.options = options;
|
|
28
|
+
_this.symbol = 'SDN';
|
|
29
|
+
_this.name = 'Shiden';
|
|
30
|
+
_this.marketSymbol = 'SDN';
|
|
31
|
+
_this.feeSymbol = 'SDN';
|
|
32
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.SHIDEN;
|
|
33
|
+
_this.units = [
|
|
34
|
+
{
|
|
35
|
+
unitSymbol: 'SDN',
|
|
36
|
+
factor: '1'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
unitSymbol: 'mSDN',
|
|
40
|
+
factor: '0.001'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
unitSymbol: 'uSDN',
|
|
44
|
+
factor: '0.000001'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
unitSymbol: 'nSDN',
|
|
48
|
+
factor: '0.000000001'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
unitSymbol: 'pSDN',
|
|
52
|
+
factor: '0.000000000001'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
unitSymbol: 'fSDN',
|
|
56
|
+
factor: '0.000000000000001'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
unitSymbol: 'aSDN',
|
|
60
|
+
factor: '0.000000000000000001'
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
_this.standardDerivationPath = "m/44'/810'/0'/0/0";
|
|
64
|
+
_this.addressIsCaseSensitive = true;
|
|
65
|
+
_this.addressValidationPattern = '^[a-km-zA-HJ-NP-Z1-9]+$';
|
|
66
|
+
_this.addressPlaceholder = "ABC...";
|
|
67
|
+
return _this;
|
|
68
|
+
}
|
|
69
|
+
return ShidenProtocol;
|
|
70
|
+
}(AstarProtocol_1.AstarProtocol));
|
|
71
|
+
exports.ShidenProtocol = ShidenProtocol;
|
|
72
|
+
//# sourceMappingURL=ShidenProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShidenProtocol.js","sourceRoot":"","sources":["../../../../src/v0/protocol/shiden/ShidenProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,oFAAuG;AAIvG,wDAAsD;AAEtD,iEAA+D;AAE/D;IAAoC,kCAAa;IA6C/C,wBAAmC,OAAuF;QAAvF,wBAAA,EAAA,cAAgE,6CAAqB,EAAE;QAA1H,YACE,kBAAM,OAAO,CAAC,SACf;QAFkC,aAAO,GAAP,OAAO,CAAgF;QA5CnH,YAAM,GAAW,KAAK,CAAA;QACtB,UAAI,GAAW,QAAQ,CAAA;QACvB,kBAAY,GAAW,KAAK,CAAA;QAC5B,eAAS,GAAW,KAAK,CAAA;QAEzB,gBAAU,GAAoB,qCAAmB,CAAC,MAAM,CAAA;QAExD,WAAK,GAAmB;YAC7B;gBACE,UAAU,EAAE,KAAK;gBACjB,MAAM,EAAE,GAAG;aACZ;YACD;gBACE,UAAU,EAAE,MAAM;gBAClB,MAAM,EAAE,OAAO;aAChB;YACD;gBACE,UAAU,EAAE,MAAM;gBAClB,MAAM,EAAE,UAAU;aACnB;YACD;gBACE,UAAU,EAAE,MAAM;gBAClB,MAAM,EAAE,aAAa;aACtB;YACD;gBACE,UAAU,EAAE,MAAM;gBAClB,MAAM,EAAE,gBAAgB;aACzB;YACD;gBACE,UAAU,EAAE,MAAM;gBAClB,MAAM,EAAE,mBAAmB;aAC5B;YACD;gBACE,UAAU,EAAE,MAAM;gBAClB,MAAM,EAAE,sBAAsB;aAC/B;SACF,CAAA;QAEM,4BAAsB,GAAW,mBAAmB,CAAA;QAEpD,4BAAsB,GAAY,IAAI,CAAA;QACtC,8BAAwB,GAAW,yBAAyB,CAAA;QAC5D,wBAAkB,GAAW,QAAQ,CAAA;;IAI5C,CAAC;IACH,qBAAC;AAAD,CAAC,AAhDD,CAAoC,6BAAa,GAgDhD;AAhDY,wCAAc"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ProtocolBlockExplorer } from '@wallfree-dev/coinlib-core/utils/ProtocolBlockExplorer';
|
|
2
|
+
import { NetworkType } from '@wallfree-dev/coinlib-core/utils/ProtocolNetwork';
|
|
3
|
+
import { SubscanBlockExplorer } from '@wallfree-dev/substrate/v0/protocol/SubstrateProtocolOptions';
|
|
4
|
+
import { AstarProtocolConfig, AstarProtocolNetwork, AstarProtocolNetworkExtras, BaseAstarProtocolOptions } from '../astar/AstarProtocolOptions';
|
|
5
|
+
export declare class ShidenProtocolConfig extends AstarProtocolConfig {
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
export declare class ShidenSubscanBlockExplorer extends SubscanBlockExplorer {
|
|
9
|
+
constructor(blockExplorer?: string);
|
|
10
|
+
}
|
|
11
|
+
export declare class ShidenProtocolNetworkExtras extends AstarProtocolNetworkExtras {
|
|
12
|
+
readonly apiUrl: string;
|
|
13
|
+
constructor(apiUrl?: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class ShidenProtocolNetwork extends AstarProtocolNetwork {
|
|
16
|
+
constructor(name?: string, type?: NetworkType, rpcUrl?: string, blockExplorer?: ProtocolBlockExplorer, extras?: ShidenProtocolNetworkExtras);
|
|
17
|
+
}
|
|
18
|
+
export declare class ShidenProtocolOptions extends BaseAstarProtocolOptions<ShidenProtocolConfig> {
|
|
19
|
+
readonly network: ShidenProtocolNetwork;
|
|
20
|
+
readonly config: ShidenProtocolConfig;
|
|
21
|
+
constructor(network?: ShidenProtocolNetwork, config?: ShidenProtocolConfig);
|
|
22
|
+
}
|