@wallfree-dev/polkadot 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/kusama/KusamaProtocol.d.ts +22 -0
- package/v0/protocol/kusama/KusamaProtocol.js +71 -0
- package/v0/protocol/kusama/KusamaProtocol.js.map +1 -0
- package/v0/protocol/kusama/KusamaProtocolOptions.d.ts +23 -0
- package/v0/protocol/kusama/KusamaProtocolOptions.js +85 -0
- package/v0/protocol/kusama/KusamaProtocolOptions.js.map +1 -0
- package/v0/protocol/polkadot/PolkadotProtocol.d.ts +23 -0
- package/v0/protocol/polkadot/PolkadotProtocol.js +72 -0
- package/v0/protocol/polkadot/PolkadotProtocol.js.map +1 -0
- package/v0/protocol/polkadot/PolkadotProtocolOptions.d.ts +23 -0
- package/v0/protocol/polkadot/PolkadotProtocolOptions.js +85 -0
- package/v0/protocol/polkadot/PolkadotProtocolOptions.js.map +1 -0
- package/v1/controller/PolkadotAccountController.d.ts +30 -0
- package/v1/controller/PolkadotAccountController.js +675 -0
- package/v1/controller/PolkadotAccountController.js.map +1 -0
- package/v1/controller/PolkadotTransactionController.d.ts +5 -0
- package/v1/controller/PolkadotTransactionController.js +28 -0
- package/v1/controller/PolkadotTransactionController.js.map +1 -0
- package/v1/data/staking/PolkadotActiveEraInfo.d.ts +8 -0
- package/v1/data/staking/PolkadotActiveEraInfo.js +19 -0
- package/v1/data/staking/PolkadotActiveEraInfo.js.map +1 -0
- package/v1/data/staking/PolkadotEraRewardPoints.d.ts +8 -0
- package/v1/data/staking/PolkadotEraRewardPoints.js +21 -0
- package/v1/data/staking/PolkadotEraRewardPoints.js.map +1 -0
- package/v1/data/staking/PolkadotExposure.d.ts +9 -0
- package/v1/data/staking/PolkadotExposure.js +23 -0
- package/v1/data/staking/PolkadotExposure.js.map +1 -0
- package/v1/data/staking/PolkadotNominationStatus.d.ts +5 -0
- package/v1/data/staking/PolkadotNominationStatus.js +10 -0
- package/v1/data/staking/PolkadotNominationStatus.js.map +1 -0
- package/v1/data/staking/PolkadotNominations.d.ts +9 -0
- package/v1/data/staking/PolkadotNominations.js +21 -0
- package/v1/data/staking/PolkadotNominations.js.map +1 -0
- package/v1/data/staking/PolkadotNominatorDetails.d.ts +24 -0
- package/v1/data/staking/PolkadotNominatorDetails.js +3 -0
- package/v1/data/staking/PolkadotNominatorDetails.js.map +1 -0
- package/v1/data/staking/PolkadotPayee.d.ts +5 -0
- package/v1/data/staking/PolkadotPayee.js +10 -0
- package/v1/data/staking/PolkadotPayee.js.map +1 -0
- package/v1/data/staking/PolkadotSlashingSpans.d.ts +10 -0
- package/v1/data/staking/PolkadotSlashingSpans.js +23 -0
- package/v1/data/staking/PolkadotSlashingSpans.js.map +1 -0
- package/v1/data/staking/PolkadotStakingActionType.d.ts +14 -0
- package/v1/data/staking/PolkadotStakingActionType.js +19 -0
- package/v1/data/staking/PolkadotStakingActionType.js.map +1 -0
- package/v1/data/staking/PolkadotStakingBalance.d.ts +5 -0
- package/v1/data/staking/PolkadotStakingBalance.js +3 -0
- package/v1/data/staking/PolkadotStakingBalance.js.map +1 -0
- package/v1/data/staking/PolkadotStakingLedger.d.ts +11 -0
- package/v1/data/staking/PolkadotStakingLedger.js +27 -0
- package/v1/data/staking/PolkadotStakingLedger.js.map +1 -0
- package/v1/data/staking/PolkadotValidatorDetails.d.ts +16 -0
- package/v1/data/staking/PolkadotValidatorDetails.js +3 -0
- package/v1/data/staking/PolkadotValidatorDetails.js.map +1 -0
- package/v1/data/staking/PolkadotValidatorPrefs.d.ts +7 -0
- package/v1/data/staking/PolkadotValidatorPrefs.js +17 -0
- package/v1/data/staking/PolkadotValidatorPrefs.js.map +1 -0
- package/v1/data/transaction/method/args.d.ts +2 -0
- package/v1/data/transaction/method/args.js +441 -0
- package/v1/data/transaction/method/args.js.map +1 -0
- package/v1/data/transaction/transaction.d.ts +2 -0
- package/v1/data/transaction/transaction.js +28 -0
- package/v1/data/transaction/transaction.js.map +1 -0
- package/v1/index.d.ts +15 -0
- package/v1/index.js +16 -0
- package/v1/index.js.map +1 -0
- package/v1/module/PolkadotModule.d.ts +19 -0
- package/v1/module/PolkadotModule.js +113 -0
- package/v1/module/PolkadotModule.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/PolkadotNodeClient.d.ts +45 -0
- package/v1/node/PolkadotNodeClient.js +319 -0
- package/v1/node/PolkadotNodeClient.js.map +1 -0
- package/v1/protocol/KusamaProtocol.d.ts +14 -0
- package/v1/protocol/KusamaProtocol.js +106 -0
- package/v1/protocol/KusamaProtocol.js.map +1 -0
- package/v1/protocol/PolkadotBaseProtocol.d.ts +57 -0
- package/v1/protocol/PolkadotBaseProtocol.js +737 -0
- package/v1/protocol/PolkadotBaseProtocol.js.map +1 -0
- package/v1/protocol/PolkadotProtocol.d.ts +14 -0
- package/v1/protocol/PolkadotProtocol.js +119 -0
- package/v1/protocol/PolkadotProtocol.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-polkadot.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-polkadot.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-polkadot.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-polkadot.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-polkadot.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-polkadot.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-polkadot.json +36 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-polkadot.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 +11 -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 +13 -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/polkadot",
|
|
3
|
+
"version": "0.13.42",
|
|
4
|
+
"description": "The @wallfree-dev/polkadot is a Polkadot implementation of the ICoinProtocol interface from @wallfree-dev/coinlib-core.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"airgap",
|
|
7
|
+
"blockchain",
|
|
8
|
+
"crypto",
|
|
9
|
+
"substrate",
|
|
10
|
+
"polkadot",
|
|
11
|
+
"kusama"
|
|
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/polkadot.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 airgapCoinLibPolkadot > ./dist/airgap-coinlib-polkadot.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/substrate": "^0.13.42"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
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/polkadot",
|
|
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 { KusamaProtocol } from './protocol/kusama/KusamaProtocol';
|
|
2
|
+
import { KusamaProtocolConfig, KusamaProtocolNetwork, KusamaProtocolNetworkExtras, KusamaProtocolOptions, KusamaSubscanBlockExplorer } from './protocol/kusama/KusamaProtocolOptions';
|
|
3
|
+
import { PolkadotProtocol } from './protocol/polkadot/PolkadotProtocol';
|
|
4
|
+
import { PolkadotProtocolConfig, PolkadotProtocolNetwork, PolkadotProtocolNetworkExtras, PolkadotProtocolOptions, PolkadotSubscanBlockExplorer } from './protocol/polkadot/PolkadotProtocolOptions';
|
|
5
|
+
export { PolkadotProtocol, KusamaProtocol, KusamaProtocolNetworkExtras, KusamaSubscanBlockExplorer as KusamaPolkascanBlockExplorer, KusamaProtocolConfig, KusamaProtocolNetwork, KusamaProtocolOptions, PolkadotProtocolNetworkExtras, PolkadotSubscanBlockExplorer, PolkadotProtocolConfig, PolkadotProtocolNetwork, PolkadotProtocolOptions };
|
package/v0/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolkadotProtocolOptions = exports.PolkadotProtocolNetwork = exports.PolkadotProtocolConfig = exports.PolkadotSubscanBlockExplorer = exports.PolkadotProtocolNetworkExtras = exports.KusamaProtocolOptions = exports.KusamaProtocolNetwork = exports.KusamaProtocolConfig = exports.KusamaPolkascanBlockExplorer = exports.KusamaProtocolNetworkExtras = exports.KusamaProtocol = exports.PolkadotProtocol = void 0;
|
|
4
|
+
var coinlib_core_1 = require("@wallfree-dev/coinlib-core");
|
|
5
|
+
var serializer_1 = require("@wallfree-dev/serializer");
|
|
6
|
+
var KusamaProtocol_1 = require("./protocol/kusama/KusamaProtocol");
|
|
7
|
+
Object.defineProperty(exports, "KusamaProtocol", { enumerable: true, get: function () { return KusamaProtocol_1.KusamaProtocol; } });
|
|
8
|
+
var KusamaProtocolOptions_1 = require("./protocol/kusama/KusamaProtocolOptions");
|
|
9
|
+
Object.defineProperty(exports, "KusamaProtocolConfig", { enumerable: true, get: function () { return KusamaProtocolOptions_1.KusamaProtocolConfig; } });
|
|
10
|
+
Object.defineProperty(exports, "KusamaProtocolNetwork", { enumerable: true, get: function () { return KusamaProtocolOptions_1.KusamaProtocolNetwork; } });
|
|
11
|
+
Object.defineProperty(exports, "KusamaProtocolNetworkExtras", { enumerable: true, get: function () { return KusamaProtocolOptions_1.KusamaProtocolNetworkExtras; } });
|
|
12
|
+
Object.defineProperty(exports, "KusamaProtocolOptions", { enumerable: true, get: function () { return KusamaProtocolOptions_1.KusamaProtocolOptions; } });
|
|
13
|
+
Object.defineProperty(exports, "KusamaPolkascanBlockExplorer", { enumerable: true, get: function () { return KusamaProtocolOptions_1.KusamaSubscanBlockExplorer; } });
|
|
14
|
+
var PolkadotProtocol_1 = require("./protocol/polkadot/PolkadotProtocol");
|
|
15
|
+
Object.defineProperty(exports, "PolkadotProtocol", { enumerable: true, get: function () { return PolkadotProtocol_1.PolkadotProtocol; } });
|
|
16
|
+
var PolkadotProtocolOptions_1 = require("./protocol/polkadot/PolkadotProtocolOptions");
|
|
17
|
+
Object.defineProperty(exports, "PolkadotProtocolConfig", { enumerable: true, get: function () { return PolkadotProtocolOptions_1.PolkadotProtocolConfig; } });
|
|
18
|
+
Object.defineProperty(exports, "PolkadotProtocolNetwork", { enumerable: true, get: function () { return PolkadotProtocolOptions_1.PolkadotProtocolNetwork; } });
|
|
19
|
+
Object.defineProperty(exports, "PolkadotProtocolNetworkExtras", { enumerable: true, get: function () { return PolkadotProtocolOptions_1.PolkadotProtocolNetworkExtras; } });
|
|
20
|
+
Object.defineProperty(exports, "PolkadotProtocolOptions", { enumerable: true, get: function () { return PolkadotProtocolOptions_1.PolkadotProtocolOptions; } });
|
|
21
|
+
Object.defineProperty(exports, "PolkadotSubscanBlockExplorer", { enumerable: true, get: function () { return PolkadotProtocolOptions_1.PolkadotSubscanBlockExplorer; } });
|
|
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.POLKADOT);
|
|
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.POLKADOT);
|
|
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.POLKADOT);
|
|
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.POLKADOT);
|
|
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.KUSAMA);
|
|
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.KUSAMA);
|
|
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.KUSAMA);
|
|
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.KUSAMA);
|
|
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,mEAAiE;AAmB/D,+FAnBO,+BAAc,OAmBP;AAlBhB,iFAMgD;AAe9C,qGApBA,4CAAoB,OAoBA;AACpB,sGApBA,6CAAqB,OAoBA;AAHrB,4GAhBA,mDAA2B,OAgBA;AAI3B,sGAnBA,6CAAqB,OAmBA;AAHS,6GAf9B,kDAA0B,OAegC;AAb5D,yEAAuE;AAUrE,iGAVO,mCAAgB,OAUP;AATlB,uFAMoD;AAYlD,uGAjBA,gDAAsB,OAiBA;AACtB,wGAjBA,iDAAuB,OAiBA;AAHvB,8GAbA,uDAA6B,OAaA;AAI7B,wGAhBA,iDAAuB,OAgBA;AAHvB,6GAZA,sDAA4B,OAYA;AAM9B,aAAa;AAEb,uBAAU,CAAC,SAAS,CAClB,2BAAc,CAAC,sBAAsB,EACrC,EAAE,MAAM,EAAE,OAAO,CAAC,0FAA0F,CAAC,EAAE,EAC/G,kCAAmB,CAAC,QAAQ,CAC7B,CAAA;AACD,uBAAU,CAAC,SAAS,CAClB,2BAAc,CAAC,uBAAuB,EACtC,EAAE,MAAM,EAAE,OAAO,CAAC,2FAA2F,CAAC,EAAE,EAChH,kCAAmB,CAAC,QAAQ,CAC7B,CAAA;AAED,yBAAY,CAAC,SAAS,CACpB,2BAAc,CAAC,sBAAsB,EACrC,EAAE,MAAM,EAAE,OAAO,CAAC,0FAA0F,CAAC,EAAE,EAC/G,kCAAmB,CAAC,QAAQ,CAC7B,CAAA;AACD,yBAAY,CAAC,SAAS,CACpB,2BAAc,CAAC,uBAAuB,EACtC,EAAE,MAAM,EAAE,OAAO,CAAC,2FAA2F,CAAC,EAAE,EAChH,kCAAmB,CAAC,QAAQ,CAC7B,CAAA;AAED,uBAAU,CAAC,SAAS,CAClB,2BAAc,CAAC,sBAAsB,EACrC,EAAE,MAAM,EAAE,OAAO,CAAC,0FAA0F,CAAC,EAAE,EAC/G,kCAAmB,CAAC,MAAM,CAC3B,CAAA;AACD,uBAAU,CAAC,SAAS,CAClB,2BAAc,CAAC,uBAAuB,EACtC,EAAE,MAAM,EAAE,OAAO,CAAC,2FAA2F,CAAC,EAAE,EAChH,kCAAmB,CAAC,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 KusamaProtocol extends SubstrateDelegateProtocol<SubstrateNetwork.KUSAMA> {
|
|
7
|
+
readonly options: SubstrateProtocolOptions<SubstrateNetwork.KUSAMA>;
|
|
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.KUSAMA>);
|
|
22
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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.KusamaProtocol = 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 KusamaProtocolOptions_1 = require("./KusamaProtocolOptions");
|
|
22
|
+
var KusamaProtocol = /** @class */ (function (_super) {
|
|
23
|
+
__extends(KusamaProtocol, _super);
|
|
24
|
+
function KusamaProtocol(options) {
|
|
25
|
+
if (options === void 0) { options = new KusamaProtocolOptions_1.KusamaProtocolOptions(); }
|
|
26
|
+
var _this = _super.call(this, options) || this;
|
|
27
|
+
_this.options = options;
|
|
28
|
+
_this.symbol = 'KSM';
|
|
29
|
+
_this.name = 'Kusama';
|
|
30
|
+
_this.marketSymbol = 'KSM';
|
|
31
|
+
_this.feeSymbol = 'KSM';
|
|
32
|
+
_this.decimals = 12;
|
|
33
|
+
_this.feeDecimals = 12;
|
|
34
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.KUSAMA;
|
|
35
|
+
_this.feeDefaults = {
|
|
36
|
+
low: '0.001',
|
|
37
|
+
medium: '0.001',
|
|
38
|
+
high: '0.001'
|
|
39
|
+
};
|
|
40
|
+
_this.units = [
|
|
41
|
+
{
|
|
42
|
+
unitSymbol: 'KSM',
|
|
43
|
+
factor: '1'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
unitSymbol: 'mKSM',
|
|
47
|
+
factor: '0.001'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
unitSymbol: 'uKSM',
|
|
51
|
+
factor: '0.000001'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
unitSymbol: 'Point',
|
|
55
|
+
factor: '0.000000001'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
unitSymbol: 'Planck',
|
|
59
|
+
factor: '0.000000000001'
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
_this.standardDerivationPath = "m/44'/434'/0'/0/0";
|
|
63
|
+
_this.addressIsCaseSensitive = true;
|
|
64
|
+
_this.addressValidationPattern = '^[C-HJ][a-km-zA-HJ-NP-Z1-9]+$';
|
|
65
|
+
_this.addressPlaceholder = "C/D/E/F/G/H/J...";
|
|
66
|
+
return _this;
|
|
67
|
+
}
|
|
68
|
+
return KusamaProtocol;
|
|
69
|
+
}(SubstrateDelegateProtocol_1.SubstrateDelegateProtocol));
|
|
70
|
+
exports.KusamaProtocol = KusamaProtocol;
|
|
71
|
+
//# sourceMappingURL=KusamaProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KusamaProtocol.js","sourceRoot":"","sources":["../../../../src/v0/protocol/kusama/KusamaProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,oFAAuG;AACvG,2GAAyG;AAIzG,iEAA+D;AAE/D;IAAoC,kCAAkD;IA6CpF,wBAAmC,OAAwF;QAAxF,wBAAA,EAAA,cAAiE,6CAAqB,EAAE;QAA3H,YACE,kBAAM,OAAO,CAAC,SACf;QAFkC,aAAO,GAAP,OAAO,CAAiF;QA5CpH,YAAM,GAAW,KAAK,CAAA;QACtB,UAAI,GAAW,QAAQ,CAAA;QACvB,kBAAY,GAAW,KAAK,CAAA;QAC5B,eAAS,GAAW,KAAK,CAAA;QAEzB,cAAQ,GAAW,EAAE,CAAA;QACrB,iBAAW,GAAW,EAAE,CAAA;QACxB,gBAAU,GAAoB,qCAAmB,CAAC,MAAM,CAAA;QAExD,iBAAW,GAAgB;YAChC,GAAG,EAAE,OAAO;YACZ,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,OAAO;SACd,CAAA;QAEM,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,OAAO;gBACnB,MAAM,EAAE,aAAa;aACtB;YACD;gBACE,UAAU,EAAE,QAAQ;gBACpB,MAAM,EAAE,gBAAgB;aACzB;SACF,CAAA;QAEM,4BAAsB,GAAW,mBAAmB,CAAA;QAEpD,4BAAsB,GAAY,IAAI,CAAA;QACtC,8BAAwB,GAAW,+BAA+B,CAAA;QAClE,wBAAkB,GAAW,kBAAkB,CAAA;;IAItD,CAAC;IACH,qBAAC;AAAD,CAAC,AAhDD,CAAoC,qDAAyB,GAgD5D;AAhDY,wCAAc"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 KusamaProtocolNetworkExtras extends SubstrateProtocolNetworkExtras<SubstrateNetwork.KUSAMA> {
|
|
7
|
+
readonly apiUrl: string;
|
|
8
|
+
constructor(apiUrl?: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class KusamaSubscanBlockExplorer extends SubscanBlockExplorer {
|
|
11
|
+
constructor(blockExplorer?: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class KusamaProtocolConfig extends SubstrateProtocolConfig {
|
|
14
|
+
constructor();
|
|
15
|
+
}
|
|
16
|
+
export declare class KusamaProtocolNetwork extends ProtocolNetwork<KusamaProtocolNetworkExtras> {
|
|
17
|
+
constructor(name?: string, type?: NetworkType, rpcUrl?: string, blockExplorer?: ProtocolBlockExplorer, extras?: KusamaProtocolNetworkExtras);
|
|
18
|
+
}
|
|
19
|
+
export declare class KusamaProtocolOptions extends SubstrateProtocolOptions<SubstrateNetwork.KUSAMA, KusamaProtocolConfig> {
|
|
20
|
+
readonly network: KusamaProtocolNetwork;
|
|
21
|
+
readonly config: KusamaProtocolConfig;
|
|
22
|
+
constructor(network?: KusamaProtocolNetwork, config?: KusamaProtocolConfig, nodeClient?: SubstrateNodeClient<SubstrateNetwork.KUSAMA>);
|
|
23
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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.KusamaProtocolOptions = exports.KusamaProtocolNetwork = exports.KusamaProtocolConfig = exports.KusamaSubscanBlockExplorer = exports.KusamaProtocolNetworkExtras = 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://polkadot-kusama-node.prod.gke.papers.tech';
|
|
28
|
+
var BLOCK_EXPLORER_URL = 'https://kusama.subscan.io';
|
|
29
|
+
var BLOCK_EXPLORER_API = 'https://kusama.subscan.prod.gke.papers.tech/api/scan';
|
|
30
|
+
var KusamaProtocolNetworkExtras = /** @class */ (function (_super) {
|
|
31
|
+
__extends(KusamaProtocolNetworkExtras, _super);
|
|
32
|
+
function KusamaProtocolNetworkExtras(apiUrl) {
|
|
33
|
+
if (apiUrl === void 0) { apiUrl = BLOCK_EXPLORER_API; }
|
|
34
|
+
var _this = _super.call(this, apiUrl, SubstrateNetwork_1.SubstrateNetwork.KUSAMA) || this;
|
|
35
|
+
_this.apiUrl = apiUrl;
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
return KusamaProtocolNetworkExtras;
|
|
39
|
+
}(SubstrateProtocolOptions_1.SubstrateProtocolNetworkExtras));
|
|
40
|
+
exports.KusamaProtocolNetworkExtras = KusamaProtocolNetworkExtras;
|
|
41
|
+
var KusamaSubscanBlockExplorer = /** @class */ (function (_super) {
|
|
42
|
+
__extends(KusamaSubscanBlockExplorer, _super);
|
|
43
|
+
function KusamaSubscanBlockExplorer(blockExplorer) {
|
|
44
|
+
if (blockExplorer === void 0) { blockExplorer = BLOCK_EXPLORER_URL; }
|
|
45
|
+
return _super.call(this, blockExplorer) || this;
|
|
46
|
+
}
|
|
47
|
+
return KusamaSubscanBlockExplorer;
|
|
48
|
+
}(SubstrateProtocolOptions_1.SubscanBlockExplorer));
|
|
49
|
+
exports.KusamaSubscanBlockExplorer = KusamaSubscanBlockExplorer;
|
|
50
|
+
var KusamaProtocolConfig = /** @class */ (function (_super) {
|
|
51
|
+
__extends(KusamaProtocolConfig, _super);
|
|
52
|
+
function KusamaProtocolConfig() {
|
|
53
|
+
return _super.call(this) || this;
|
|
54
|
+
}
|
|
55
|
+
return KusamaProtocolConfig;
|
|
56
|
+
}(SubstrateProtocolOptions_1.SubstrateProtocolConfig));
|
|
57
|
+
exports.KusamaProtocolConfig = KusamaProtocolConfig;
|
|
58
|
+
var KusamaProtocolNetwork = /** @class */ (function (_super) {
|
|
59
|
+
__extends(KusamaProtocolNetwork, _super);
|
|
60
|
+
function KusamaProtocolNetwork(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 KusamaSubscanBlockExplorer(); }
|
|
65
|
+
if (extras === void 0) { extras = new KusamaProtocolNetworkExtras(); }
|
|
66
|
+
return _super.call(this, name, type, rpcUrl, blockExplorer, extras) || this;
|
|
67
|
+
}
|
|
68
|
+
return KusamaProtocolNetwork;
|
|
69
|
+
}(ProtocolNetwork_1.ProtocolNetwork));
|
|
70
|
+
exports.KusamaProtocolNetwork = KusamaProtocolNetwork;
|
|
71
|
+
var KusamaProtocolOptions = /** @class */ (function (_super) {
|
|
72
|
+
__extends(KusamaProtocolOptions, _super);
|
|
73
|
+
function KusamaProtocolOptions(network, config, nodeClient) {
|
|
74
|
+
if (network === void 0) { network = new KusamaProtocolNetwork(); }
|
|
75
|
+
if (config === void 0) { config = new KusamaProtocolConfig(); }
|
|
76
|
+
if (nodeClient === void 0) { nodeClient = new SubstrateNodeClient_1.SubstrateNodeClient(network.extras.network, network.rpcUrl); }
|
|
77
|
+
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;
|
|
78
|
+
_this.network = network;
|
|
79
|
+
_this.config = config;
|
|
80
|
+
return _this;
|
|
81
|
+
}
|
|
82
|
+
return KusamaProtocolOptions;
|
|
83
|
+
}(SubstrateProtocolOptions_1.SubstrateProtocolOptions));
|
|
84
|
+
exports.KusamaProtocolOptions = KusamaProtocolOptions;
|
|
85
|
+
//# sourceMappingURL=KusamaProtocolOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KusamaProtocolOptions.js","sourceRoot":"","sources":["../../../../src/v0/protocol/kusama/KusamaProtocolOptions.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,mDAAmD,CAAA;AAE5E,IAAM,kBAAkB,GAAW,2BAA2B,CAAA;AAC9D,IAAM,kBAAkB,GAAW,sDAAsD,CAAA;AAEzF;IAAiD,+CAAuD;IACtG,qCAA4B,MAAmC;QAAnC,uBAAA,EAAA,2BAAmC;QAA/D,YACE,kBAAM,MAAM,EAAE,mCAAgB,CAAC,MAAM,CAAC,SACvC;QAF2B,YAAM,GAAN,MAAM,CAA6B;;IAE/D,CAAC;IACH,kCAAC;AAAD,CAAC,AAJD,CAAiD,yDAA8B,GAI9E;AAJY,kEAA2B;AAMxC;IAAgD,8CAAoB;IAClE,oCAAY,aAA0C;QAA1C,8BAAA,EAAA,kCAA0C;eACpD,kBAAM,aAAa,CAAC;IACtB,CAAC;IACH,iCAAC;AAAD,CAAC,AAJD,CAAgD,+CAAoB,GAInE;AAJY,gEAA0B;AAMvC;IAA0C,wCAAuB;IAC/D;eACE,iBAAO;IACT,CAAC;IACH,2BAAC;AAAD,CAAC,AAJD,CAA0C,kDAAuB,GAIhE;AAJY,oDAAoB;AAMjC;IAA2C,yCAA4C;IACrF,+BACE,IAA2B,EAC3B,IAAuC,EACvC,MAAyB,EACzB,aAAuE,EACvE,MAAuE;QAJvE,qBAAA,EAAA,mBAA2B;QAC3B,qBAAA,EAAA,OAAoB,6BAAW,CAAC,OAAO;QACvC,uBAAA,EAAA,iBAAyB;QACzB,8BAAA,EAAA,oBAA2C,0BAA0B,EAAE;QACvE,uBAAA,EAAA,aAA0C,2BAA2B,EAAE;eAEvE,kBAAM,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC;IAClD,CAAC;IACH,4BAAC;AAAD,CAAC,AAVD,CAA2C,iCAAe,GAUzD;AAVY,sDAAqB;AAYlC;IAA2C,yCAAuE;IAChH,+BACkB,OAA4D,EAC5D,MAAyD,EACzE,UAA0H;QAF1G,wBAAA,EAAA,cAAqC,qBAAqB,EAAE;QAC5D,uBAAA,EAAA,aAAmC,oBAAoB,EAAE;QACzE,2BAAA,EAAA,iBAA+D,yCAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC;QAH5H,YAKE,kBACE,OAAO,EACP,MAAM,EACN,UAAU,EACV,IAAI,uDAA0B,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,EAClE,IAAI,+DAA8B,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CACvE,SACF;QAXiB,aAAO,GAAP,OAAO,CAAqD;QAC5D,YAAM,GAAN,MAAM,CAAmD;;IAU3E,CAAC;IACH,4BAAC;AAAD,CAAC,AAdD,CAA2C,mDAAwB,GAclE;AAdY,sDAAqB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 PolkadotProtocol extends SubstrateDelegateProtocol<SubstrateNetwork.POLKADOT> {
|
|
7
|
+
readonly options: SubstrateProtocolOptions<SubstrateNetwork.POLKADOT>;
|
|
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
|
+
defaultValidator: string;
|
|
22
|
+
constructor(options?: SubstrateProtocolOptions<SubstrateNetwork.POLKADOT>);
|
|
23
|
+
}
|
|
@@ -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.PolkadotProtocol = 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 PolkadotProtocolOptions_1 = require("./PolkadotProtocolOptions");
|
|
22
|
+
var PolkadotProtocol = /** @class */ (function (_super) {
|
|
23
|
+
__extends(PolkadotProtocol, _super);
|
|
24
|
+
function PolkadotProtocol(options) {
|
|
25
|
+
if (options === void 0) { options = new PolkadotProtocolOptions_1.PolkadotProtocolOptions(); }
|
|
26
|
+
var _this = _super.call(this, options) || this;
|
|
27
|
+
_this.options = options;
|
|
28
|
+
_this.symbol = 'DOT';
|
|
29
|
+
_this.name = 'Polkadot';
|
|
30
|
+
_this.marketSymbol = 'DOT';
|
|
31
|
+
_this.feeSymbol = 'DOT';
|
|
32
|
+
_this.decimals = 10;
|
|
33
|
+
_this.feeDecimals = 10;
|
|
34
|
+
_this.identifier = ProtocolSymbols_1.MainProtocolSymbols.POLKADOT;
|
|
35
|
+
_this.feeDefaults = {
|
|
36
|
+
low: '0.01',
|
|
37
|
+
medium: '0.01',
|
|
38
|
+
high: '0.01'
|
|
39
|
+
};
|
|
40
|
+
_this.units = [
|
|
41
|
+
{
|
|
42
|
+
unitSymbol: 'DOT',
|
|
43
|
+
factor: '1'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
unitSymbol: 'mDOT',
|
|
47
|
+
factor: '0.001'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
unitSymbol: 'uDOT',
|
|
51
|
+
factor: '0.000001'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
unitSymbol: 'Point',
|
|
55
|
+
factor: '0.000000001'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
unitSymbol: 'Planck',
|
|
59
|
+
factor: '0.0000000001'
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
_this.standardDerivationPath = "m/44'/354'/0'/0/0";
|
|
63
|
+
_this.addressIsCaseSensitive = true;
|
|
64
|
+
_this.addressValidationPattern = '^1[a-km-zA-HJ-NP-Z1-9]+$';
|
|
65
|
+
_this.addressPlaceholder = "1ABC...";
|
|
66
|
+
_this.defaultValidator = '12C9U6zSSoZ6pgwR2ksFyBLgQH6v7dkqqPCRyHceoP8MJRo2';
|
|
67
|
+
return _this;
|
|
68
|
+
}
|
|
69
|
+
return PolkadotProtocol;
|
|
70
|
+
}(SubstrateDelegateProtocol_1.SubstrateDelegateProtocol));
|
|
71
|
+
exports.PolkadotProtocol = PolkadotProtocol;
|
|
72
|
+
//# sourceMappingURL=PolkadotProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PolkadotProtocol.js","sourceRoot":"","sources":["../../../../src/v0/protocol/polkadot/PolkadotProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,oFAAuG;AACvG,2GAAyG;AAIzG,qEAAmE;AAEnE;IAAsC,oCAAoD;IA+CxF,0BAAmC,OAA4F;QAA5F,wBAAA,EAAA,cAAmE,iDAAuB,EAAE;QAA/H,YACE,kBAAM,OAAO,CAAC,SACf;QAFkC,aAAO,GAAP,OAAO,CAAqF;QA9CxH,YAAM,GAAW,KAAK,CAAA;QACtB,UAAI,GAAW,UAAU,CAAA;QACzB,kBAAY,GAAW,KAAK,CAAA;QAC5B,eAAS,GAAW,KAAK,CAAA;QAEzB,cAAQ,GAAW,EAAE,CAAA;QACrB,iBAAW,GAAW,EAAE,CAAA;QACxB,gBAAU,GAAoB,qCAAmB,CAAC,QAAQ,CAAA;QAE1D,iBAAW,GAAgB;YAChC,GAAG,EAAE,MAAM;YACX,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAM;SACb,CAAA;QAEM,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,OAAO;gBACnB,MAAM,EAAE,aAAa;aACtB;YACD;gBACE,UAAU,EAAE,QAAQ;gBACpB,MAAM,EAAE,cAAc;aACvB;SACF,CAAA;QAEM,4BAAsB,GAAW,mBAAmB,CAAA;QAEpD,4BAAsB,GAAY,IAAI,CAAA;QACtC,8BAAwB,GAAW,0BAA0B,CAAA;QAC7D,wBAAkB,GAAW,SAAS,CAAA;QAEtC,sBAAgB,GAAW,kDAAkD,CAAA;;IAIpF,CAAC;IACH,uBAAC;AAAD,CAAC,AAlDD,CAAsC,qDAAyB,GAkD9D;AAlDY,4CAAgB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 PolkadotProtocolNetworkExtras extends SubstrateProtocolNetworkExtras<SubstrateNetwork.POLKADOT> {
|
|
7
|
+
readonly apiUrl: string;
|
|
8
|
+
constructor(apiUrl?: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class PolkadotSubscanBlockExplorer extends SubscanBlockExplorer {
|
|
11
|
+
constructor(blockExplorer?: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class PolkadotProtocolConfig extends SubstrateProtocolConfig {
|
|
14
|
+
constructor();
|
|
15
|
+
}
|
|
16
|
+
export declare class PolkadotProtocolNetwork extends ProtocolNetwork<PolkadotProtocolNetworkExtras> {
|
|
17
|
+
constructor(name?: string, type?: NetworkType, rpcUrl?: string, blockExplorer?: ProtocolBlockExplorer, extras?: PolkadotProtocolNetworkExtras);
|
|
18
|
+
}
|
|
19
|
+
export declare class PolkadotProtocolOptions extends SubstrateProtocolOptions<SubstrateNetwork.POLKADOT, PolkadotProtocolConfig> {
|
|
20
|
+
readonly network: PolkadotProtocolNetwork;
|
|
21
|
+
readonly config: PolkadotProtocolConfig;
|
|
22
|
+
constructor(network?: PolkadotProtocolNetwork, config?: PolkadotProtocolConfig, nodeClient?: SubstrateNodeClient<SubstrateNetwork.POLKADOT>);
|
|
23
|
+
}
|