koilib 2.5.0 → 2.7.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/README.md +6 -6
- package/dist/koinos.js +2986 -4607
- package/dist/koinos.min.js +1 -1
- package/dist/koinos.min.js.LICENSE.txt +2 -2
- package/lib/Contract.d.ts +9 -11
- package/lib/Contract.js +20 -20
- package/lib/Contract.js.map +1 -1
- package/lib/Provider.d.ts +24 -17
- package/lib/Provider.js +99 -105
- package/lib/Provider.js.map +1 -1
- package/lib/Serializer.js +9 -9
- package/lib/Serializer.js.map +1 -1
- package/lib/Signer.d.ts +9 -9
- package/lib/Signer.js +30 -22
- package/lib/Signer.js.map +1 -1
- package/lib/browser/Contract.d.ts +200 -0
- package/lib/browser/Contract.js +298 -0
- package/lib/browser/Contract.js.map +1 -0
- package/lib/browser/Provider.d.ts +160 -0
- package/lib/browser/Provider.js +246 -0
- package/lib/browser/Provider.js.map +1 -0
- package/lib/browser/Serializer.d.ts +81 -0
- package/lib/browser/Serializer.js +169 -0
- package/lib/browser/Serializer.js.map +1 -0
- package/lib/browser/Signer.d.ts +296 -0
- package/lib/browser/Signer.js +429 -0
- package/lib/browser/Signer.js.map +1 -0
- package/lib/browser/index.d.ts +7 -0
- package/lib/browser/index.js +34 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/browser/index2.d.ts +2 -0
- package/lib/browser/index2.js +33 -0
- package/lib/browser/index2.js.map +1 -0
- package/lib/browser/interface.d.ts +279 -0
- package/lib/browser/interface.js +3 -0
- package/lib/browser/interface.js.map +1 -0
- package/lib/browser/jsonDescriptors/krc20-proto.json +183 -0
- package/lib/browser/jsonDescriptors/protocol-proto.json +246 -0
- package/lib/browser/utils.d.ts +326 -0
- package/lib/browser/utils.js +252 -0
- package/lib/browser/utils.js.map +1 -0
- package/lib/interface.d.ts +24 -25
- package/lib/utils.d.ts +12 -8
- package/lib/utils.js +7 -7
- package/lib/utils.js.map +1 -1
- package/package.json +34 -31
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ProtocolTypes = exports.Krc20Abi = exports.parseUnits = exports.formatUnits = exports.bitcoinAddress = exports.bitcoinDecode = exports.bitcoinEncode = exports.decodeBase64 = exports.encodeBase64 = exports.decodeBase58 = exports.encodeBase58 = exports.toHexString = exports.toUint8Array = void 0;
|
|
26
|
+
const multibase = __importStar(require("multibase"));
|
|
27
|
+
const sha256_1 = require("@noble/hashes/sha256");
|
|
28
|
+
const ripemd160_1 = require("@noble/hashes/ripemd160");
|
|
29
|
+
const krc20_proto_json_1 = __importDefault(require("./jsonDescriptors/krc20-proto.json"));
|
|
30
|
+
const protocol_proto_json_1 = __importDefault(require("./jsonDescriptors/protocol-proto.json"));
|
|
31
|
+
/**
|
|
32
|
+
* Converts an hex string to Uint8Array
|
|
33
|
+
*/
|
|
34
|
+
function toUint8Array(hex) {
|
|
35
|
+
const pairs = hex.match(/[\dA-F]{2}/gi);
|
|
36
|
+
if (!pairs)
|
|
37
|
+
throw new Error("Invalid hex");
|
|
38
|
+
return new Uint8Array(pairs.map((s) => parseInt(s, 16)) // convert to integers
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
exports.toUint8Array = toUint8Array;
|
|
42
|
+
/**
|
|
43
|
+
* Converts Uint8Array to hex string
|
|
44
|
+
*/
|
|
45
|
+
function toHexString(buffer) {
|
|
46
|
+
return Array.from(buffer)
|
|
47
|
+
.map((n) => `0${Number(n).toString(16)}`.slice(-2))
|
|
48
|
+
.join("");
|
|
49
|
+
}
|
|
50
|
+
exports.toHexString = toHexString;
|
|
51
|
+
/**
|
|
52
|
+
* Encodes an Uint8Array in base58
|
|
53
|
+
*/
|
|
54
|
+
function encodeBase58(buffer) {
|
|
55
|
+
return new TextDecoder().decode(multibase.encode("z", buffer)).slice(1);
|
|
56
|
+
}
|
|
57
|
+
exports.encodeBase58 = encodeBase58;
|
|
58
|
+
/**
|
|
59
|
+
* Decodes a buffer formatted in base58
|
|
60
|
+
*/
|
|
61
|
+
function decodeBase58(bs58) {
|
|
62
|
+
return multibase.decode(`z${bs58}`);
|
|
63
|
+
}
|
|
64
|
+
exports.decodeBase58 = decodeBase58;
|
|
65
|
+
/**
|
|
66
|
+
* Encodes an Uint8Array in base64
|
|
67
|
+
*/
|
|
68
|
+
function encodeBase64(buffer) {
|
|
69
|
+
return new TextDecoder().decode(multibase.encode("U", buffer)).slice(1);
|
|
70
|
+
}
|
|
71
|
+
exports.encodeBase64 = encodeBase64;
|
|
72
|
+
/**
|
|
73
|
+
* Decodes a buffer formatted in base64
|
|
74
|
+
*/
|
|
75
|
+
function decodeBase64(bs64) {
|
|
76
|
+
return multibase.decode(`U${bs64}`);
|
|
77
|
+
}
|
|
78
|
+
exports.decodeBase64 = decodeBase64;
|
|
79
|
+
/**
|
|
80
|
+
* Encodes a public or private key in base58 using
|
|
81
|
+
* the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
|
|
82
|
+
* and [Bitcoin WIF](https://en.bitcoin.it/wiki/Wallet_import_format)).
|
|
83
|
+
*
|
|
84
|
+
* For private keys this encode is also known as
|
|
85
|
+
* wallet import format (WIF).
|
|
86
|
+
*/
|
|
87
|
+
function bitcoinEncode(buffer, type, compressed = false) {
|
|
88
|
+
let bufferCheck;
|
|
89
|
+
let prefixBuffer;
|
|
90
|
+
let offsetChecksum;
|
|
91
|
+
if (type === "public") {
|
|
92
|
+
bufferCheck = new Uint8Array(25);
|
|
93
|
+
prefixBuffer = new Uint8Array(21);
|
|
94
|
+
bufferCheck[0] = 0;
|
|
95
|
+
prefixBuffer[0] = 0;
|
|
96
|
+
offsetChecksum = 21;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
if (compressed) {
|
|
100
|
+
bufferCheck = new Uint8Array(38);
|
|
101
|
+
prefixBuffer = new Uint8Array(34);
|
|
102
|
+
offsetChecksum = 34;
|
|
103
|
+
bufferCheck[33] = 1;
|
|
104
|
+
prefixBuffer[33] = 1;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
bufferCheck = new Uint8Array(37);
|
|
108
|
+
prefixBuffer = new Uint8Array(33);
|
|
109
|
+
offsetChecksum = 33;
|
|
110
|
+
}
|
|
111
|
+
bufferCheck[0] = 128;
|
|
112
|
+
prefixBuffer[0] = 128;
|
|
113
|
+
}
|
|
114
|
+
prefixBuffer.set(buffer, 1);
|
|
115
|
+
const firstHash = (0, sha256_1.sha256)(prefixBuffer);
|
|
116
|
+
const doubleHash = (0, sha256_1.sha256)(firstHash);
|
|
117
|
+
const checksum = new Uint8Array(4);
|
|
118
|
+
checksum.set(doubleHash.slice(0, 4));
|
|
119
|
+
bufferCheck.set(buffer, 1);
|
|
120
|
+
bufferCheck.set(checksum, offsetChecksum);
|
|
121
|
+
return encodeBase58(bufferCheck);
|
|
122
|
+
}
|
|
123
|
+
exports.bitcoinEncode = bitcoinEncode;
|
|
124
|
+
/**
|
|
125
|
+
* Decodes a public or private key formatted in base58 using
|
|
126
|
+
* the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
|
|
127
|
+
* and [Bitcoin WIF](https://en.bitcoin.it/wiki/Wallet_import_format)).
|
|
128
|
+
*
|
|
129
|
+
* For private keys this encode is also known as
|
|
130
|
+
* wallet import format (WIF).
|
|
131
|
+
*/
|
|
132
|
+
function bitcoinDecode(value) {
|
|
133
|
+
const buffer = decodeBase58(value);
|
|
134
|
+
const privateKey = new Uint8Array(32);
|
|
135
|
+
const checksum = new Uint8Array(4);
|
|
136
|
+
// const prefix = buffer[0];
|
|
137
|
+
privateKey.set(buffer.slice(1, 33));
|
|
138
|
+
if (value[0] !== "5") {
|
|
139
|
+
// compressed
|
|
140
|
+
checksum.set(buffer.slice(34, 38));
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
checksum.set(buffer.slice(33, 37));
|
|
144
|
+
}
|
|
145
|
+
// TODO: verify prefix and checksum
|
|
146
|
+
return privateKey;
|
|
147
|
+
}
|
|
148
|
+
exports.bitcoinDecode = bitcoinDecode;
|
|
149
|
+
/**
|
|
150
|
+
* Computes a bitcoin address, which is the format used in Koinos
|
|
151
|
+
*
|
|
152
|
+
* address = bitcoinEncode( ripemd160 ( sha256 ( publicKey ) ) )
|
|
153
|
+
*/
|
|
154
|
+
function bitcoinAddress(publicKey) {
|
|
155
|
+
const hash = (0, sha256_1.sha256)(publicKey);
|
|
156
|
+
const hash160 = (0, ripemd160_1.ripemd160)(hash);
|
|
157
|
+
return bitcoinEncode(hash160, "public");
|
|
158
|
+
}
|
|
159
|
+
exports.bitcoinAddress = bitcoinAddress;
|
|
160
|
+
/**
|
|
161
|
+
* Function to format a number in a decimal point number
|
|
162
|
+
* @example
|
|
163
|
+
* ```js
|
|
164
|
+
* const amount = formatUnits("123456", 8);
|
|
165
|
+
* console.log(amount);
|
|
166
|
+
* // '0.00123456'
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
function formatUnits(value, decimals) {
|
|
170
|
+
let v = typeof value === "string" ? value : BigInt(value).toString();
|
|
171
|
+
const sign = v[0] === "-" ? "-" : "";
|
|
172
|
+
v = v.replace("-", "").padStart(decimals + 1, "0");
|
|
173
|
+
const integerPart = v
|
|
174
|
+
.substring(0, v.length - decimals)
|
|
175
|
+
.replace(/^0+(?=\d)/, "");
|
|
176
|
+
const decimalPart = v.substring(v.length - decimals);
|
|
177
|
+
return `${sign}${integerPart}.${decimalPart}`.replace(/(\.0+)?(0+)$/, "");
|
|
178
|
+
}
|
|
179
|
+
exports.formatUnits = formatUnits;
|
|
180
|
+
/**
|
|
181
|
+
* Function to format a decimal point number in an integer
|
|
182
|
+
* @example
|
|
183
|
+
* ```js
|
|
184
|
+
* const amount = parseUnits("0.00123456", 8);
|
|
185
|
+
* console.log(amount);
|
|
186
|
+
* // '123456'
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
function parseUnits(value, decimals) {
|
|
190
|
+
const sign = value[0] === "-" ? "-" : "";
|
|
191
|
+
// eslint-disable-next-line prefer-const
|
|
192
|
+
let [integerPart, decimalPart] = value
|
|
193
|
+
.replace("-", "")
|
|
194
|
+
.replace(",", ".")
|
|
195
|
+
.split(".");
|
|
196
|
+
if (!decimalPart)
|
|
197
|
+
decimalPart = "";
|
|
198
|
+
decimalPart = decimalPart.padEnd(decimals, "0");
|
|
199
|
+
return `${sign}${`${integerPart}${decimalPart}`.replace(/^0+(?=\d)/, "")}`;
|
|
200
|
+
}
|
|
201
|
+
exports.parseUnits = parseUnits;
|
|
202
|
+
/**
|
|
203
|
+
* ABI for tokens
|
|
204
|
+
*/
|
|
205
|
+
exports.Krc20Abi = {
|
|
206
|
+
methods: {
|
|
207
|
+
name: {
|
|
208
|
+
entryPoint: 0x76ea4297,
|
|
209
|
+
input: "name_arguments",
|
|
210
|
+
output: "name_result",
|
|
211
|
+
readOnly: true,
|
|
212
|
+
},
|
|
213
|
+
symbol: {
|
|
214
|
+
entryPoint: 0x7e794b24,
|
|
215
|
+
input: "symbol_arguments",
|
|
216
|
+
output: "symbol_result",
|
|
217
|
+
readOnly: true,
|
|
218
|
+
},
|
|
219
|
+
decimals: {
|
|
220
|
+
entryPoint: 0x59dc15ce,
|
|
221
|
+
input: "decimals_arguments",
|
|
222
|
+
output: "decimals_result",
|
|
223
|
+
readOnly: true,
|
|
224
|
+
},
|
|
225
|
+
totalSupply: {
|
|
226
|
+
entryPoint: 0xcf2e8212,
|
|
227
|
+
input: "total_supply_arguments",
|
|
228
|
+
output: "total_supply_result",
|
|
229
|
+
readOnly: true,
|
|
230
|
+
},
|
|
231
|
+
balanceOf: {
|
|
232
|
+
entryPoint: 0x15619248,
|
|
233
|
+
input: "balance_of_arguments",
|
|
234
|
+
output: "balance_of_result",
|
|
235
|
+
readOnly: true,
|
|
236
|
+
defaultOutput: { value: "0" },
|
|
237
|
+
},
|
|
238
|
+
transfer: {
|
|
239
|
+
entryPoint: 0x62efa292,
|
|
240
|
+
input: "transfer_arguments",
|
|
241
|
+
output: "transfer_result",
|
|
242
|
+
},
|
|
243
|
+
mint: {
|
|
244
|
+
entryPoint: 0xc2f82bdc,
|
|
245
|
+
input: "mint_arguments",
|
|
246
|
+
output: "mint_result",
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
types: krc20_proto_json_1.default,
|
|
250
|
+
};
|
|
251
|
+
exports.ProtocolTypes = protocol_proto_json_1.default;
|
|
252
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;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,KAAK,EAAE,gBAAgB;YACvB,MAAM,EAAE,aAAa;SACtB;KACF;IACD,KAAK,EAAE,0BAAc;CACtB,CAAC;AAEW,QAAA,aAAa,GAAG,6BAAY,CAAC"}
|
package/lib/interface.d.ts
CHANGED
|
@@ -132,28 +132,25 @@ export interface RecoverPublicKeyOptions {
|
|
|
132
132
|
*/
|
|
133
133
|
transformSignature?: (signatureData: string) => Promise<string>;
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
wait: (type?: "byBlock" | "byTransactionId", timeout?: number) => Promise<string | number>;
|
|
155
|
-
}
|
|
156
|
-
declare type NumberLike = number | bigint | string;
|
|
135
|
+
/**
|
|
136
|
+
* Function to wait for a transaction to be mined.
|
|
137
|
+
* This function comes as a response after sending a transaction.
|
|
138
|
+
* See [[Provider.sendTransaction]]
|
|
139
|
+
*
|
|
140
|
+
* @param type - Type must be "byBlock" (default) or "byTransactionId".
|
|
141
|
+
* _byBlock_ will query the blockchain to get blocks and search for the
|
|
142
|
+
* transaction there. _byTransactionId_ will query the "transaction store"
|
|
143
|
+
* microservice to search the transaction by its id. If non of them is
|
|
144
|
+
* specified the function will use "byBlock" (as "byTransactionId"
|
|
145
|
+
* requires the transaction store, which is an optional microservice).
|
|
146
|
+
*
|
|
147
|
+
* When _byBlock_ is used it returns the block number.
|
|
148
|
+
*
|
|
149
|
+
* When _byTransactionId_ is used it returns the block id.
|
|
150
|
+
*
|
|
151
|
+
* @param timeout - Timeout in milliseconds. By default it is 30000
|
|
152
|
+
*/
|
|
153
|
+
export declare type WaitFunction = (type?: "byBlock" | "byTransactionId", timeout?: number) => Promise<string | number>;
|
|
157
154
|
export interface UploadContractOperation {
|
|
158
155
|
contract_id?: Uint8Array;
|
|
159
156
|
bytecode?: Uint8Array;
|
|
@@ -262,10 +259,13 @@ export interface TransactionJson {
|
|
|
262
259
|
*/
|
|
263
260
|
signature_data?: string;
|
|
264
261
|
}
|
|
262
|
+
export interface TransactionJsonWait extends TransactionJson {
|
|
263
|
+
wait: WaitFunction;
|
|
264
|
+
}
|
|
265
265
|
export interface BlockHeaderJson {
|
|
266
266
|
previous?: string;
|
|
267
|
-
height?:
|
|
268
|
-
timestamp?:
|
|
267
|
+
height?: string;
|
|
268
|
+
timestamp?: string;
|
|
269
269
|
[x: string]: unknown;
|
|
270
270
|
}
|
|
271
271
|
export interface BlockJson {
|
|
@@ -277,4 +277,3 @@ export interface BlockJson {
|
|
|
277
277
|
transactions?: TransactionJson[];
|
|
278
278
|
[x: string]: unknown;
|
|
279
279
|
}
|
|
280
|
-
export {};
|
package/lib/utils.d.ts
CHANGED
|
@@ -122,6 +122,14 @@ export declare const ProtocolTypes: {
|
|
|
122
122
|
};
|
|
123
123
|
};
|
|
124
124
|
bytecode: {
|
|
125
|
+
/**
|
|
126
|
+
* Encodes a public or private key in base58 using
|
|
127
|
+
* the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
|
|
128
|
+
* and [Bitcoin WIF](https://en.bitcoin.it/wiki/Wallet_import_format)).
|
|
129
|
+
*
|
|
130
|
+
* For private keys this encode is also known as
|
|
131
|
+
* wallet import format (WIF).
|
|
132
|
+
*/
|
|
125
133
|
type: string;
|
|
126
134
|
id: number;
|
|
127
135
|
};
|
|
@@ -166,14 +174,7 @@ export declare const ProtocolTypes: {
|
|
|
166
174
|
};
|
|
167
175
|
fields: {
|
|
168
176
|
upload_contract: {
|
|
169
|
-
type: string;
|
|
170
|
-
* Decodes a public or private key formatted in base58 using
|
|
171
|
-
* the bitcoin format (see [Bitcoin Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)
|
|
172
|
-
* and [Bitcoin WIF](https://en.bitcoin.it/wiki/Wallet_import_format)).
|
|
173
|
-
*
|
|
174
|
-
* For private keys this encode is also known as
|
|
175
|
-
* wallet import format (WIF).
|
|
176
|
-
*/
|
|
177
|
+
type: string;
|
|
177
178
|
id: number;
|
|
178
179
|
};
|
|
179
180
|
call_contract: {
|
|
@@ -258,6 +259,9 @@ export declare const ProtocolTypes: {
|
|
|
258
259
|
fields: {
|
|
259
260
|
previous: {
|
|
260
261
|
type: string;
|
|
262
|
+
/**
|
|
263
|
+
* ABI for tokens
|
|
264
|
+
*/
|
|
261
265
|
id: number;
|
|
262
266
|
options: {
|
|
263
267
|
"(koinos_bytes_type)": string;
|
package/lib/utils.js
CHANGED
|
@@ -24,8 +24,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.ProtocolTypes = exports.Krc20Abi = exports.parseUnits = exports.formatUnits = exports.bitcoinAddress = exports.bitcoinDecode = exports.bitcoinEncode = exports.decodeBase64 = exports.encodeBase64 = exports.decodeBase58 = exports.encodeBase58 = exports.toHexString = exports.toUint8Array = void 0;
|
|
26
26
|
const multibase = __importStar(require("multibase"));
|
|
27
|
-
const sha256_1 = require("@noble/hashes/
|
|
28
|
-
const ripemd160_1 = require("@noble/hashes/
|
|
27
|
+
const sha256_1 = require("@noble/hashes/sha256");
|
|
28
|
+
const ripemd160_1 = require("@noble/hashes/ripemd160");
|
|
29
29
|
const krc20_proto_json_1 = __importDefault(require("./jsonDescriptors/krc20-proto.json"));
|
|
30
30
|
const protocol_proto_json_1 = __importDefault(require("./jsonDescriptors/protocol-proto.json"));
|
|
31
31
|
/**
|
|
@@ -112,8 +112,8 @@ function bitcoinEncode(buffer, type, compressed = false) {
|
|
|
112
112
|
prefixBuffer[0] = 128;
|
|
113
113
|
}
|
|
114
114
|
prefixBuffer.set(buffer, 1);
|
|
115
|
-
const firstHash = sha256_1.sha256(prefixBuffer);
|
|
116
|
-
const doubleHash = sha256_1.sha256(firstHash);
|
|
115
|
+
const firstHash = (0, sha256_1.sha256)(prefixBuffer);
|
|
116
|
+
const doubleHash = (0, sha256_1.sha256)(firstHash);
|
|
117
117
|
const checksum = new Uint8Array(4);
|
|
118
118
|
checksum.set(doubleHash.slice(0, 4));
|
|
119
119
|
bufferCheck.set(buffer, 1);
|
|
@@ -152,8 +152,8 @@ exports.bitcoinDecode = bitcoinDecode;
|
|
|
152
152
|
* address = bitcoinEncode( ripemd160 ( sha256 ( publicKey ) ) )
|
|
153
153
|
*/
|
|
154
154
|
function bitcoinAddress(publicKey) {
|
|
155
|
-
const hash = sha256_1.sha256(publicKey);
|
|
156
|
-
const hash160 = ripemd160_1.ripemd160(hash);
|
|
155
|
+
const hash = (0, sha256_1.sha256)(publicKey);
|
|
156
|
+
const hash160 = (0, ripemd160_1.ripemd160)(hash);
|
|
157
157
|
return bitcoinEncode(hash160, "public");
|
|
158
158
|
}
|
|
159
159
|
exports.bitcoinAddress = bitcoinAddress;
|
|
@@ -242,7 +242,7 @@ exports.Krc20Abi = {
|
|
|
242
242
|
},
|
|
243
243
|
mint: {
|
|
244
244
|
entryPoint: 0xc2f82bdc,
|
|
245
|
-
input: "
|
|
245
|
+
input: "mint_arguments",
|
|
246
246
|
output: "mint_result",
|
|
247
247
|
},
|
|
248
248
|
},
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,iDAA8C;AAC9C,uDAAoD;AACpD,0FAAgE;AAChE,gGAAiE;AAGjE;;GAEG;AACH,SAAgB,YAAY,CAAC,GAAW;I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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koilib",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "JS Koinos Library",
|
|
5
5
|
"author": "Julian Gonzalez",
|
|
6
6
|
"repository": {
|
|
@@ -16,20 +16,23 @@
|
|
|
16
16
|
],
|
|
17
17
|
"main": "./lib/index.js",
|
|
18
18
|
"types": "./lib/index.d.ts",
|
|
19
|
-
"browser": "./lib/index.js",
|
|
19
|
+
"browser": "./lib/browser/index.js",
|
|
20
20
|
"scripts": {
|
|
21
21
|
"audit": "audit-ci",
|
|
22
|
-
"build": "
|
|
22
|
+
"build": "yarn build:node && yarn build:browser",
|
|
23
|
+
"build:node": "node helperNodeBrowser.js --node && rimraf lib && tsc -p tsconfig.node.json",
|
|
24
|
+
"build:browser": "rimraf lib/browser && node helperNodeBrowser.js --browser && tsc -p tsconfig.browser.json && node helperNodeBrowser.js --node",
|
|
23
25
|
"bundle": "yarn bundle:no-min && yarn bundle:min",
|
|
24
|
-
"bundle:min": "webpack --mode=production --config webpack.prod.config.js",
|
|
25
|
-
"bundle:no-min": "webpack --mode=production --config webpack.dev.config.js",
|
|
26
|
+
"bundle:min": "node helperNodeBrowser.js --browser && webpack --mode=production --config webpack.prod.config.js && node helperNodeBrowser.js --node",
|
|
27
|
+
"bundle:no-min": "node helperNodeBrowser.js --browser && webpack --mode=production --config webpack.dev.config.js && node helperNodeBrowser.js --browser",
|
|
26
28
|
"docs": "typedoc src/index.ts --includeVersion",
|
|
27
29
|
"clean": "rimraf dist coverage",
|
|
30
|
+
"fix:provider": "node helperNodeBrowser.js --node",
|
|
28
31
|
"lint": "yarn lint:prettier && yarn lint:eslint && yarn lint:tsc",
|
|
29
32
|
"lint:prettier": "prettier . --check",
|
|
30
33
|
"lint:eslint": "eslint . --ext .js,.ts",
|
|
31
34
|
"lint:tsc": "tsc --noEmit --incremental false",
|
|
32
|
-
"prerelease": "yarn
|
|
35
|
+
"prerelease": "yarn bundle && yarn docs && yarn build",
|
|
33
36
|
"proto": "node generateJsonKoinosProto.js",
|
|
34
37
|
"test": "jest",
|
|
35
38
|
"test:unit": "jest wallet.spec.ts",
|
|
@@ -41,40 +44,40 @@
|
|
|
41
44
|
".": "./lib/index.js"
|
|
42
45
|
},
|
|
43
46
|
"dependencies": {
|
|
44
|
-
"@noble/hashes": "^0.
|
|
45
|
-
"@noble/secp256k1": "^1.
|
|
46
|
-
"
|
|
47
|
-
"multibase": "^4.0.
|
|
47
|
+
"@noble/hashes": "^1.0.0",
|
|
48
|
+
"@noble/secp256k1": "^1.5.0",
|
|
49
|
+
"cross-fetch": "^3.1.4",
|
|
50
|
+
"multibase": "^4.0.6",
|
|
48
51
|
"protobufjs": "^6.11.2"
|
|
49
52
|
},
|
|
50
53
|
"devDependencies": {
|
|
51
54
|
"@tsconfig/node12": "^1.0.9",
|
|
52
|
-
"@types/jest": "^
|
|
53
|
-
"@types/node": "^
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
55
|
-
"@typescript-eslint/parser": "^
|
|
56
|
-
"audit-ci": "^
|
|
55
|
+
"@types/jest": "^27.4.0",
|
|
56
|
+
"@types/node": "^17.0.10",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
58
|
+
"@typescript-eslint/parser": "^5.10.0",
|
|
59
|
+
"audit-ci": "^5.1.2",
|
|
57
60
|
"copyfiles": "^2.4.1",
|
|
58
|
-
"dotenv": "^
|
|
59
|
-
"eslint": "^7.
|
|
60
|
-
"eslint-config-airbnb-typescript": "^
|
|
61
|
+
"dotenv": "^14.2.0",
|
|
62
|
+
"eslint": "^8.7.0",
|
|
63
|
+
"eslint-config-airbnb-typescript": "^16.1.0",
|
|
61
64
|
"eslint-config-prettier": "^8.3.0",
|
|
62
|
-
"eslint-plugin-import": "^2.
|
|
63
|
-
"eslint-plugin-jest": "^
|
|
64
|
-
"eslint-plugin-prettier": "^
|
|
65
|
+
"eslint-plugin-import": "^2.25.4",
|
|
66
|
+
"eslint-plugin-jest": "^25.7.0",
|
|
67
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
65
68
|
"eslint-plugin-tsdoc": "^0.2.14",
|
|
66
|
-
"fastify": "^3.
|
|
69
|
+
"fastify": "^3.26.0",
|
|
67
70
|
"fastify-cors": "^6.0.2",
|
|
68
71
|
"fastify-static": "^4.5.0",
|
|
69
|
-
"jest": "^27.
|
|
70
|
-
"jest-puppeteer": "^
|
|
71
|
-
"prettier": "^2.
|
|
72
|
+
"jest": "^27.4.7",
|
|
73
|
+
"jest-puppeteer": "^6.0.3",
|
|
74
|
+
"prettier": "^2.5.1",
|
|
72
75
|
"rimraf": "^3.0.2",
|
|
73
|
-
"ts-jest": "^27.
|
|
74
|
-
"ts-loader": "^9.2.
|
|
75
|
-
"typedoc": "^0.
|
|
76
|
-
"typescript": "^4.
|
|
77
|
-
"webpack": "^5.
|
|
78
|
-
"webpack-cli": "^4.
|
|
76
|
+
"ts-jest": "^27.1.3",
|
|
77
|
+
"ts-loader": "^9.2.6",
|
|
78
|
+
"typedoc": "^0.22.11",
|
|
79
|
+
"typescript": "^4.5.4",
|
|
80
|
+
"webpack": "^5.66.0",
|
|
81
|
+
"webpack-cli": "^4.9.1"
|
|
79
82
|
}
|
|
80
83
|
}
|