@cityofzion/bs-neo3 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/operation/build/state.json +3 -0
- package/.rush/temp/package-deps_build.json +20 -0
- package/.rush/temp/shrinkwrap-deps.json +120 -0
- package/bs-neo3.build.log +2 -0
- package/dist/BDSNeo3.d.ts +15 -0
- package/dist/BDSNeo3.js +211 -0
- package/dist/BSNeo3.d.ts +48 -0
- package/dist/BSNeo3.js +230 -0
- package/dist/assets/tokens.json +128 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +13 -0
- package/dist/excpetions.d.ts +3 -0
- package/dist/excpetions.js +8 -0
- package/dist/explorer/dora/DoraNeo3Responses.d.ts +174 -0
- package/dist/explorer/dora/DoraNeo3Responses.js +3 -0
- package/dist/explorer/dora/DoraNeo3Routes.d.ts +6 -0
- package/dist/explorer/dora/DoraNeo3Routes.js +9 -0
- package/dist/explorer/index.d.ts +6 -0
- package/dist/explorer/index.js +23 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +22 -0
- package/docs/assets/main.js +58 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1280 -0
- package/docs/classes/BDSNeo3.html +253 -0
- package/docs/classes/BSNeo3.html +431 -0
- package/docs/index.html +82 -0
- package/docs/interfaces/DoraNeo3Abi.html +78 -0
- package/docs/interfaces/DoraNeo3Asset.html +117 -0
- package/docs/interfaces/DoraNeo3AssetState.html +96 -0
- package/docs/interfaces/DoraNeo3Balance.html +89 -0
- package/docs/interfaces/DoraNeo3ConsensusNode.html +75 -0
- package/docs/interfaces/DoraNeo3Contract.html +110 -0
- package/docs/interfaces/DoraNeo3Event.html +75 -0
- package/docs/interfaces/DoraNeo3Features.html +84 -0
- package/docs/interfaces/DoraNeo3HistoryState.html +75 -0
- package/docs/interfaces/DoraNeo3Invocation.html +75 -0
- package/docs/interfaces/DoraNeo3Item.html +131 -0
- package/docs/interfaces/DoraNeo3Manifest.html +117 -0
- package/docs/interfaces/DoraNeo3Metadata.html +138 -0
- package/docs/interfaces/DoraNeo3Method.html +102 -0
- package/docs/interfaces/DoraNeo3Nef.html +103 -0
- package/docs/interfaces/DoraNeo3Notification.html +82 -0
- package/docs/interfaces/DoraNeo3Parameter.html +75 -0
- package/docs/interfaces/DoraNeo3Permission.html +75 -0
- package/docs/interfaces/DoraNeo3Signer.html +75 -0
- package/docs/interfaces/DoraNeo3Token.html +96 -0
- package/docs/interfaces/DoraNeo3Transaction.html +166 -0
- package/docs/interfaces/DoraNeo3TransactionHistory.html +75 -0
- package/docs/interfaces/DoraNeo3Transfer.html +117 -0
- package/docs/interfaces/DoraNeo3Witness.html +75 -0
- package/docs/modules.html +122 -0
- package/docs/variables/DORA_ASSET.html +81 -0
- package/docs/variables/DORA_BALANCE.html +81 -0
- package/docs/variables/DORA_CONTRACT.html +81 -0
- package/docs/variables/DORA_NODES.html +81 -0
- package/docs/variables/DORA_TRANSACTION.html +81 -0
- package/docs/variables/DORA_TRANSACTIONS.html +81 -0
- package/docs/variables/explorerOptions.html +86 -0
- package/docs/variables/gasInfoNeo3.html +90 -0
- package/docs/variables/neoInfoNeo3.html +90 -0
- package/package.json +28 -0
- package/src/BDSNeo3.ts +168 -0
- package/src/BSNeo3.ts +205 -0
- package/src/assets/blockchain_icon_neo.png +0 -0
- package/src/assets/blockchain_icon_neo_white.png +0 -0
- package/src/assets/tokens.json +129 -0
- package/src/constants.ts +11 -0
- package/src/excpetions.ts +5 -0
- package/src/explorer/dora/DoraNeo3Responses.ts +207 -0
- package/src/explorer/dora/DoraNeo3Routes.ts +6 -0
- package/src/explorer/index.ts +8 -0
- package/src/index.ts +4 -0
- package/tsconfig.json +13 -0
package/dist/BSNeo3.js
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.BSNeo3 = void 0;
|
|
39
|
+
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
40
|
+
const neon_js_1 = require("@cityofzion/neon-js");
|
|
41
|
+
const AsteroidSDK = __importStar(require("@moonlight-io/asteroid-sdk-js"));
|
|
42
|
+
const constants_1 = require("./constants");
|
|
43
|
+
const excpetions_1 = require("./excpetions");
|
|
44
|
+
const explorer_1 = require("./explorer");
|
|
45
|
+
const tokens_json_1 = __importDefault(require("./assets/tokens.json"));
|
|
46
|
+
const NEO_NS_HASH = "0x50ac1c37690cc2cfc594472833cf57505d5f46de";
|
|
47
|
+
class BSNeo3 {
|
|
48
|
+
constructor(blockchainName) {
|
|
49
|
+
this.dataService = explorer_1.explorerOptions.dora;
|
|
50
|
+
this.derivationPath = "m/44'/888'/0'/0/?";
|
|
51
|
+
this.feeToken = constants_1.gasInfoNeo3;
|
|
52
|
+
this.exchange = blockchain_service_1.exchangeOptions.flamingo;
|
|
53
|
+
this.tokenClaim = constants_1.neoInfoNeo3;
|
|
54
|
+
this.tokens = tokens_json_1.default;
|
|
55
|
+
this.keychain = new AsteroidSDK.Keychain();
|
|
56
|
+
this.blockchainName = blockchainName;
|
|
57
|
+
}
|
|
58
|
+
sendTransaction(param) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
try {
|
|
61
|
+
const { senderAccount, transactionIntents } = param;
|
|
62
|
+
const node = yield this.dataService.getHigherNode();
|
|
63
|
+
const facade = yield neon_js_1.api.NetworkFacade.fromConfig({ node: node.url });
|
|
64
|
+
const intents = this.buildTransfer(transactionIntents, senderAccount);
|
|
65
|
+
const signing = this.signTransfer(senderAccount);
|
|
66
|
+
const result = yield facade.transferToken(intents, signing);
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
buildTransfer(transactionIntents, account) {
|
|
75
|
+
const intents = [];
|
|
76
|
+
const neoAccount = new neon_js_1.wallet.Account(account.getWif());
|
|
77
|
+
for (const transactionIntent of transactionIntents) {
|
|
78
|
+
const { amount, receiverAddress, tokenHash } = transactionIntent;
|
|
79
|
+
intents.push({
|
|
80
|
+
to: receiverAddress,
|
|
81
|
+
contractHash: tokenHash,
|
|
82
|
+
from: neoAccount,
|
|
83
|
+
decimalAmt: amount,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return intents;
|
|
87
|
+
}
|
|
88
|
+
signTransfer(account) {
|
|
89
|
+
const neoAccount = new neon_js_1.wallet.Account(account.getWif());
|
|
90
|
+
const result = {
|
|
91
|
+
signingCallback: neon_js_1.api.signWithAccount(neoAccount)
|
|
92
|
+
};
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
generateMnemonic() {
|
|
96
|
+
var _a;
|
|
97
|
+
this.keychain.generateMnemonic(128);
|
|
98
|
+
const list = (_a = this.keychain.mnemonic) === null || _a === void 0 ? void 0 : _a.toString();
|
|
99
|
+
if (!list)
|
|
100
|
+
throw new Error("Failed to generate mnemonic");
|
|
101
|
+
return list;
|
|
102
|
+
}
|
|
103
|
+
generateWif(mnemonic, index) {
|
|
104
|
+
this.keychain.importMnemonic(mnemonic);
|
|
105
|
+
const childKey = this.keychain.generateChildKey('neo', this.derivationPath.replace('?', index.toString()));
|
|
106
|
+
return childKey.getWIF();
|
|
107
|
+
}
|
|
108
|
+
generateAccount(mnemonic, index) {
|
|
109
|
+
const wif = this.generateWif(mnemonic, index);
|
|
110
|
+
const { address } = new neon_js_1.wallet.Account(wif);
|
|
111
|
+
return { address, wif };
|
|
112
|
+
}
|
|
113
|
+
generateAccountFromWif(wif) {
|
|
114
|
+
const { address } = new neon_js_1.wallet.Account(wif);
|
|
115
|
+
return address;
|
|
116
|
+
}
|
|
117
|
+
decryptKey(encryptedKey, password) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
const wif = yield neon_js_1.wallet.decrypt(encryptedKey, password);
|
|
120
|
+
const { address } = new neon_js_1.wallet.Account(wif);
|
|
121
|
+
return { address, wif };
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
validateAddress(address) {
|
|
125
|
+
return neon_js_1.wallet.isAddress(address);
|
|
126
|
+
}
|
|
127
|
+
validateEncryptedKey(encryptedKey) {
|
|
128
|
+
return neon_js_1.wallet.isNEP2(encryptedKey);
|
|
129
|
+
}
|
|
130
|
+
validateWif(wif) {
|
|
131
|
+
return neon_js_1.wallet.isWIF(wif);
|
|
132
|
+
}
|
|
133
|
+
calculateTransferFee(param) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
const node = yield this.dataService.getHigherNode();
|
|
136
|
+
const url = node.url;
|
|
137
|
+
const rpcClient = new neon_js_1.rpc.NeoServerRpcClient(url);
|
|
138
|
+
const intents = this.buildTransfer(param.transactionIntents, param.senderAccount);
|
|
139
|
+
const txBuilder = new neon_js_1.api.TransactionBuilder();
|
|
140
|
+
for (const intent of intents) {
|
|
141
|
+
if (intent.decimalAmt) {
|
|
142
|
+
const [tokenInfo] = yield neon_js_1.api.getTokenInfos([intent.contractHash], rpcClient);
|
|
143
|
+
const amt = neon_js_1.u.BigInteger.fromDecimal(intent.decimalAmt, tokenInfo.decimals);
|
|
144
|
+
txBuilder.addNep17Transfer(intent.from, intent.to, intent.contractHash, amt);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const txn = txBuilder.build();
|
|
148
|
+
const accountScriptHash = neon_js_1.wallet.getScriptHashFromAddress(param.senderAccount.getAddress());
|
|
149
|
+
const invokeFunctionResponse = yield rpcClient.invokeScript(neon_js_1.u.HexString.fromHex(txn.script), [
|
|
150
|
+
{
|
|
151
|
+
account: accountScriptHash,
|
|
152
|
+
scopes: String(neon_js_1.tx.WitnessScope.CalledByEntry)
|
|
153
|
+
}
|
|
154
|
+
]);
|
|
155
|
+
const systemFee = neon_js_1.u.BigInteger.fromNumber(invokeFunctionResponse.gasconsumed).toDecimal(constants_1.gasInfoNeo3.decimals);
|
|
156
|
+
const networkFeeResponse = yield rpcClient.calculateNetworkFee(txn);
|
|
157
|
+
const networkFee = (Number(networkFeeResponse) / Math.pow(10, constants_1.gasInfoNeo3.decimals));
|
|
158
|
+
const sumFee = Number(systemFee) + networkFee;
|
|
159
|
+
const result = {
|
|
160
|
+
result: sumFee,
|
|
161
|
+
details: {
|
|
162
|
+
networkFee: networkFee.toString(),
|
|
163
|
+
systemFee
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return result;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
//Claimable interface implementation
|
|
170
|
+
claim(account) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
const balance = yield this.dataService.getBalance(account.getAddress());
|
|
173
|
+
const neoHash = constants_1.neoInfoNeo3.hash;
|
|
174
|
+
const neoBalance = balance.find(balance => balance.hash === neoHash);
|
|
175
|
+
const gasBalance = balance.find(balance => balance.hash === constants_1.gasInfoNeo3.hash);
|
|
176
|
+
const neoAccount = new neon_js_1.wallet.Account(account.getWif());
|
|
177
|
+
if (!neoBalance || !gasBalance)
|
|
178
|
+
throw new Error(`Problem to claim`);
|
|
179
|
+
const dataToClaim = {
|
|
180
|
+
transactionIntents: [{ amount: neoBalance.amount, receiverAddress: account.getAddress(), tokenHash: neoBalance.hash }],
|
|
181
|
+
senderAccount: account
|
|
182
|
+
};
|
|
183
|
+
const feeToClaim = yield this.calculateTransferFee(dataToClaim);
|
|
184
|
+
if (gasBalance.amount < feeToClaim.result) {
|
|
185
|
+
excpetions_1.claimGasExceptions.InsuficientGas(String(gasBalance.amount), String(feeToClaim.result));
|
|
186
|
+
}
|
|
187
|
+
const url = (yield this.dataService.getHigherNode()).url;
|
|
188
|
+
const facade = yield neon_js_1.api.NetworkFacade.fromConfig({ node: url });
|
|
189
|
+
const signing = this.signTransfer(account);
|
|
190
|
+
const txid = yield facade.claimGas(neoAccount, signing);
|
|
191
|
+
const result = {
|
|
192
|
+
hash: constants_1.gasInfoNeo3.hash,
|
|
193
|
+
symbol: constants_1.gasInfoNeo3.symbol,
|
|
194
|
+
txid
|
|
195
|
+
};
|
|
196
|
+
return result;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
// Gets the record of a second-level domain or its subdomains with the specific type.
|
|
200
|
+
getNeoNsRecord(domainName, type) {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
const url = (yield this.dataService.getHigherNode()).url;
|
|
203
|
+
const rpcClient = new neon_js_1.rpc.NeoServerRpcClient(url);
|
|
204
|
+
return rpcClient.invokeFunction(NEO_NS_HASH, "getRecord", [
|
|
205
|
+
{
|
|
206
|
+
type: "String",
|
|
207
|
+
value: domainName,
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: "Integer",
|
|
211
|
+
value: type,
|
|
212
|
+
},
|
|
213
|
+
]);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
// Gets the domain owner. If the domain has expired, an error message is returned instead of the owner.
|
|
217
|
+
getOwnerOfNeoNsRecord(domainName) {
|
|
218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
+
const url = (yield this.dataService.getHigherNode()).url;
|
|
220
|
+
const rpcClient = new neon_js_1.rpc.NeoServerRpcClient(url);
|
|
221
|
+
return rpcClient.invokeFunction(NEO_NS_HASH, "ownerOf", [
|
|
222
|
+
{
|
|
223
|
+
type: "ByteArray",
|
|
224
|
+
value: domainName,
|
|
225
|
+
},
|
|
226
|
+
]);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
exports.BSNeo3 = BSNeo3;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"symbol": "GAS",
|
|
4
|
+
"name": "GASToken",
|
|
5
|
+
"hash": "d2a4cff31913016155e38e474a2c06d08be276cf",
|
|
6
|
+
"decimals": 8
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"symbol": "NEO",
|
|
10
|
+
"name": "NeoToken",
|
|
11
|
+
"hash": "ef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
|
|
12
|
+
"decimals": 0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"symbol": "LRB",
|
|
16
|
+
"name": "LyrebirdToken",
|
|
17
|
+
"hash": "8c07b4c9f5bc170a3922eac4f5bb7ef17b0acc8b",
|
|
18
|
+
"decimals": 8
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"symbol": "USDL",
|
|
22
|
+
"name": "LyrebirdUSDToken",
|
|
23
|
+
"hash": "a8c51aa0c177187aeed3db88bdfa908ccbc9b1a5",
|
|
24
|
+
"decimals": 8
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"symbol": "FLM",
|
|
28
|
+
"name": "FLM",
|
|
29
|
+
"hash": "0xf0151f528127558851b39c2cd8aa47da7418ab28",
|
|
30
|
+
"decimals": 8
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"symbol": "fCAKE",
|
|
34
|
+
"name": "fCAKE",
|
|
35
|
+
"hash": "0xe65b462b90516012826f8a9c4c285d8c750e3a77",
|
|
36
|
+
"decimals": 18
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"symbol": "WING",
|
|
40
|
+
"name": "WING",
|
|
41
|
+
"hash": "0xeeccd60ed722111f8400434dac3ba42c14d8beb1",
|
|
42
|
+
"decimals": 9
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"symbol": "fWETH",
|
|
46
|
+
"name": "fWETH",
|
|
47
|
+
"hash": "0xc14b601252aa5dfa6166cf35fe5ccd2e35f3fdf5",
|
|
48
|
+
"decimals": 18
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"symbol": "fWBTC",
|
|
52
|
+
"name": "fWBTC",
|
|
53
|
+
"hash": "0xd6abe115ecb75e1fa0b42f5e85934ce8c1ae2893",
|
|
54
|
+
"decimals": 8
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"symbol": "SWTH",
|
|
58
|
+
"name": "SWTHToken",
|
|
59
|
+
"hash": "0x78e1330db47634afdb5ea455302ba2d12b8d549f",
|
|
60
|
+
"decimals": 8
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"symbol": "pONT",
|
|
64
|
+
"name": "pONT",
|
|
65
|
+
"hash": "0x8122bc2212ec971690a044b37a6f52a9349b702b",
|
|
66
|
+
"decimals": 9
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"symbol": "fUSDT",
|
|
70
|
+
"name": "fUSDT",
|
|
71
|
+
"hash": "0xcd48b160c1bbc9d74997b803b9a7ad50a4bef020",
|
|
72
|
+
"decimals": 6
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"symbol": "FLUND",
|
|
76
|
+
"name": "FLUND",
|
|
77
|
+
"hash": "0xa9603a59e21d29e37ac39cf1b5f5abf5006b22a3",
|
|
78
|
+
"decimals": 8
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"symbol": "GM",
|
|
82
|
+
"name": "GhostMarketToken",
|
|
83
|
+
"hash": "0x9b049f1283515eef1d3f6ac610e1595ed25ca3e9",
|
|
84
|
+
"decimals": 8
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"symbol": "NUDES",
|
|
88
|
+
"name": "Nudes",
|
|
89
|
+
"hash": "0x340720c7107ef5721e44ed2ea8e314cce5c130fa",
|
|
90
|
+
"decimals": 8
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"symbol": "CANDY",
|
|
94
|
+
"name": "NeoCandy",
|
|
95
|
+
"hash": "0x88da18a5bca86ec8206d9b4960a7d0c4355a432f",
|
|
96
|
+
"decimals": 9
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"symbol": "DOGER",
|
|
100
|
+
"name": "DogeRift",
|
|
101
|
+
"hash": "0x322b5a366ca724801a1aa01e669b5f3d7f8c7f6f",
|
|
102
|
+
"decimals": 8
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"symbol": "DOGEF",
|
|
106
|
+
"name": "DogeFood",
|
|
107
|
+
"hash": "0xa3291b66f70d4687fc0e41977d8acb0699f235ae",
|
|
108
|
+
"decimals": 8
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"symbol": "SOM",
|
|
112
|
+
"name": "Som",
|
|
113
|
+
"hash": "0x2d4c6cf0417209a7eb410160344e224e74f87195",
|
|
114
|
+
"decimals": 8
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"symbol": "LAMBO",
|
|
118
|
+
"name": "BoomerFund",
|
|
119
|
+
"hash": "0xafdd6abedf066ff8c5fbc868cc89f80eac467142",
|
|
120
|
+
"decimals": 8
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"symbol": "bNEO",
|
|
124
|
+
"hash": "0x48c40d4666f93408be1bef038b6722404d9a4c2a",
|
|
125
|
+
"decimals": 8,
|
|
126
|
+
"name": "BurgerNEO"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.neoInfoNeo3 = exports.gasInfoNeo3 = void 0;
|
|
4
|
+
exports.gasInfoNeo3 = {
|
|
5
|
+
hash: '0xd2a4cff31913016155e38e474a2c06d08be276cf',
|
|
6
|
+
symbol: 'GAS',
|
|
7
|
+
decimals: 8
|
|
8
|
+
};
|
|
9
|
+
exports.neoInfoNeo3 = {
|
|
10
|
+
hash: '0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5',
|
|
11
|
+
symbol: 'NEO',
|
|
12
|
+
decimals: 0
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.claimGasExceptions = void 0;
|
|
4
|
+
exports.claimGasExceptions = {
|
|
5
|
+
InsuficientGas: (gasAmount, gasFee) => {
|
|
6
|
+
throw new Error(`Insuficient GAS to complete transaction, the fee it's ${gasFee} and you have ${gasAmount}`);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
export interface DoraNeo3Signer {
|
|
2
|
+
account: string;
|
|
3
|
+
scopes: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DoraNeo3Witness {
|
|
6
|
+
invocation: string;
|
|
7
|
+
verification: string;
|
|
8
|
+
}
|
|
9
|
+
export interface DoraNeo3Transaction {
|
|
10
|
+
hash: string;
|
|
11
|
+
size: number;
|
|
12
|
+
version: number;
|
|
13
|
+
nonce: number;
|
|
14
|
+
sender: string;
|
|
15
|
+
sysfee: string;
|
|
16
|
+
netfee: string;
|
|
17
|
+
validuntilblock: number;
|
|
18
|
+
signers: DoraNeo3Signer[];
|
|
19
|
+
attributes: any[];
|
|
20
|
+
script: string;
|
|
21
|
+
witnesses: DoraNeo3Witness[];
|
|
22
|
+
block: number;
|
|
23
|
+
jsonsize: number;
|
|
24
|
+
time: string;
|
|
25
|
+
}
|
|
26
|
+
export interface DoraNeo3ConsensusNode {
|
|
27
|
+
url: string;
|
|
28
|
+
height: number;
|
|
29
|
+
}
|
|
30
|
+
export interface DoraNeo3Metadata {
|
|
31
|
+
summary: string;
|
|
32
|
+
symbol: string;
|
|
33
|
+
contract_name: string;
|
|
34
|
+
scripthash: string;
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
amount: number;
|
|
38
|
+
data: string;
|
|
39
|
+
voter: string;
|
|
40
|
+
candidate: string;
|
|
41
|
+
candidate_name: string;
|
|
42
|
+
}
|
|
43
|
+
export interface DoraNeo3Invocation {
|
|
44
|
+
type: string;
|
|
45
|
+
metadata: DoraNeo3Metadata;
|
|
46
|
+
}
|
|
47
|
+
export interface DoraNeo3Transfer {
|
|
48
|
+
from: string;
|
|
49
|
+
to: string;
|
|
50
|
+
time: string;
|
|
51
|
+
scripthash: string;
|
|
52
|
+
amount: string;
|
|
53
|
+
block: number;
|
|
54
|
+
txid: string;
|
|
55
|
+
transferindex: string;
|
|
56
|
+
}
|
|
57
|
+
export interface DoraNeo3HistoryState {
|
|
58
|
+
type: string;
|
|
59
|
+
value: string;
|
|
60
|
+
}
|
|
61
|
+
export interface DoraNeo3Notification {
|
|
62
|
+
contract: string;
|
|
63
|
+
event_name: string;
|
|
64
|
+
state: DoraNeo3HistoryState[];
|
|
65
|
+
}
|
|
66
|
+
export interface DoraNeo3Item {
|
|
67
|
+
block: number;
|
|
68
|
+
hash: string;
|
|
69
|
+
invocations: DoraNeo3Invocation[];
|
|
70
|
+
netfee: string;
|
|
71
|
+
sender: string;
|
|
72
|
+
sysfee: string;
|
|
73
|
+
time: string;
|
|
74
|
+
transfers: DoraNeo3Transfer[];
|
|
75
|
+
vmstate: string;
|
|
76
|
+
notifications: DoraNeo3Notification[];
|
|
77
|
+
}
|
|
78
|
+
export interface DoraNeo3TransactionHistory {
|
|
79
|
+
items: DoraNeo3Item[];
|
|
80
|
+
totalCount: number;
|
|
81
|
+
}
|
|
82
|
+
export interface DoraNeo3Balance {
|
|
83
|
+
asset: string;
|
|
84
|
+
asset_name: string;
|
|
85
|
+
symbol: string;
|
|
86
|
+
balance: number;
|
|
87
|
+
}
|
|
88
|
+
export interface DoraNeo3Token {
|
|
89
|
+
hash: string;
|
|
90
|
+
method: string;
|
|
91
|
+
paramcount: number;
|
|
92
|
+
hasreturnvalue: boolean;
|
|
93
|
+
callflags: string;
|
|
94
|
+
}
|
|
95
|
+
export interface DoraNeo3Nef {
|
|
96
|
+
magic: number;
|
|
97
|
+
compiler: string;
|
|
98
|
+
source: string;
|
|
99
|
+
tokens: DoraNeo3Token[];
|
|
100
|
+
script: string;
|
|
101
|
+
checksum: number;
|
|
102
|
+
}
|
|
103
|
+
export interface DoraNeo3Features {
|
|
104
|
+
}
|
|
105
|
+
export interface DoraNeo3Parameter {
|
|
106
|
+
name: string;
|
|
107
|
+
type: string;
|
|
108
|
+
}
|
|
109
|
+
export interface DoraNeo3Method {
|
|
110
|
+
name: string;
|
|
111
|
+
parameters: DoraNeo3Parameter[];
|
|
112
|
+
returntype: string;
|
|
113
|
+
offset: number;
|
|
114
|
+
safe: boolean;
|
|
115
|
+
}
|
|
116
|
+
export interface DoraNeo3Event {
|
|
117
|
+
name: string;
|
|
118
|
+
parameters: DoraNeo3Parameter[];
|
|
119
|
+
}
|
|
120
|
+
export interface DoraNeo3Abi {
|
|
121
|
+
methods: DoraNeo3Method[];
|
|
122
|
+
events: DoraNeo3Event[];
|
|
123
|
+
}
|
|
124
|
+
export interface DoraNeo3Permission {
|
|
125
|
+
contract: string;
|
|
126
|
+
methods: string[];
|
|
127
|
+
}
|
|
128
|
+
export interface DoraNeo3Manifest {
|
|
129
|
+
name: string;
|
|
130
|
+
groups: any[];
|
|
131
|
+
features: DoraNeo3Features;
|
|
132
|
+
supportedstandards: string[];
|
|
133
|
+
abi: DoraNeo3Abi;
|
|
134
|
+
permissions: DoraNeo3Permission[];
|
|
135
|
+
trusts: any[];
|
|
136
|
+
extra?: any;
|
|
137
|
+
}
|
|
138
|
+
export interface DoraNeo3Contract {
|
|
139
|
+
id: number;
|
|
140
|
+
updatecounter: number;
|
|
141
|
+
hash: string;
|
|
142
|
+
nef: DoraNeo3Nef;
|
|
143
|
+
manifest: DoraNeo3Manifest;
|
|
144
|
+
block: number;
|
|
145
|
+
time: string;
|
|
146
|
+
}
|
|
147
|
+
export interface DoraNeo3Method {
|
|
148
|
+
name: string;
|
|
149
|
+
parameters: DoraNeo3Parameter[];
|
|
150
|
+
returntype: string;
|
|
151
|
+
offset: number;
|
|
152
|
+
safe: boolean;
|
|
153
|
+
}
|
|
154
|
+
export interface DoraNeo3Abi {
|
|
155
|
+
methods: DoraNeo3Method[];
|
|
156
|
+
events: DoraNeo3Event[];
|
|
157
|
+
}
|
|
158
|
+
export interface DoraNeo3AssetState {
|
|
159
|
+
id: number;
|
|
160
|
+
updatecounter: number;
|
|
161
|
+
hash: string;
|
|
162
|
+
nef: DoraNeo3Nef;
|
|
163
|
+
manifest: DoraNeo3Manifest;
|
|
164
|
+
}
|
|
165
|
+
export interface DoraNeo3Asset {
|
|
166
|
+
name: string;
|
|
167
|
+
scripthash: string;
|
|
168
|
+
firstseen: number;
|
|
169
|
+
symbol: string;
|
|
170
|
+
decimals: string;
|
|
171
|
+
state: DoraNeo3AssetState;
|
|
172
|
+
type: string;
|
|
173
|
+
time: string;
|
|
174
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const DORA_TRANSACTION = "transaction";
|
|
2
|
+
export declare const DORA_NODES = "get_all_nodes";
|
|
3
|
+
export declare const DORA_TRANSACTIONS = "address_txfull";
|
|
4
|
+
export declare const DORA_BALANCE = "balance";
|
|
5
|
+
export declare const DORA_CONTRACT = "contract";
|
|
6
|
+
export declare const DORA_ASSET = "asset";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DORA_ASSET = exports.DORA_CONTRACT = exports.DORA_BALANCE = exports.DORA_TRANSACTIONS = exports.DORA_NODES = exports.DORA_TRANSACTION = void 0;
|
|
4
|
+
exports.DORA_TRANSACTION = 'transaction';
|
|
5
|
+
exports.DORA_NODES = 'get_all_nodes';
|
|
6
|
+
exports.DORA_TRANSACTIONS = 'address_txfull';
|
|
7
|
+
exports.DORA_BALANCE = 'balance';
|
|
8
|
+
exports.DORA_CONTRACT = 'contract';
|
|
9
|
+
exports.DORA_ASSET = 'asset';
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
exports.explorerOptions = void 0;
|
|
18
|
+
__exportStar(require("./dora/DoraNeo3Responses"), exports);
|
|
19
|
+
__exportStar(require("./dora/DoraNeo3Routes"), exports);
|
|
20
|
+
const BDSNeo3_1 = require("../BDSNeo3");
|
|
21
|
+
exports.explorerOptions = {
|
|
22
|
+
dora: new BDSNeo3_1.BDSNeo3()
|
|
23
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
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("./BDSNeo3"), exports);
|
|
18
|
+
__exportStar(require("./BSNeo3"), exports);
|
|
19
|
+
__exportStar(require("./constants"), exports);
|
|
20
|
+
__exportStar(require("./explorer"), exports);
|
package/docs/.nojekyll
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--light-code-background: #FFFFFF;
|
|
3
|
+
--dark-code-background: #1E1E1E;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
@media (prefers-color-scheme: light) { :root {
|
|
7
|
+
--code-background: var(--light-code-background);
|
|
8
|
+
} }
|
|
9
|
+
|
|
10
|
+
@media (prefers-color-scheme: dark) { :root {
|
|
11
|
+
--code-background: var(--dark-code-background);
|
|
12
|
+
} }
|
|
13
|
+
|
|
14
|
+
:root[data-theme='light'] {
|
|
15
|
+
--code-background: var(--light-code-background);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:root[data-theme='dark'] {
|
|
19
|
+
--code-background: var(--dark-code-background);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
pre, code { background: var(--code-background); }
|