@com-chain/jsc3l 2.0.1-rc.2 → 2.0.1-rc.20
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 +12 -2
- package/build/bcRead.d.ts +8 -10
- package/build/bcRead.js +162 -49
- package/build/bcRead.js.map +1 -1
- package/build/bcTransaction.d.ts +8 -2
- package/build/bcTransaction.js +141 -108
- package/build/bcTransaction.js.map +1 -1
- package/build/blockies.js.map +1 -1
- package/build/config/transactions.d.ts +44 -0
- package/build/config/transactions.js +29 -0
- package/build/config/transactions.js.map +1 -0
- package/build/connection.d.ts +1 -1
- package/build/connection.js +44 -13
- package/build/connection.js.map +1 -1
- package/build/customization.js +13 -6
- package/build/customization.js.map +1 -1
- package/build/ethereum/cipher.js +3 -3
- package/build/ethereum/cipher.js.map +1 -1
- package/build/ethereum/ethFuncs.js +37 -1
- package/build/ethereum/ethFuncs.js.map +1 -1
- package/build/ethereum/etherUnits.js +5 -5
- package/build/ethereum/etherUnits.js.map +1 -1
- package/build/ethereum/myetherwallet.d.ts +1 -2
- package/build/ethereum/myetherwallet.js.map +1 -1
- package/build/ethereum/uiFuncs.d.ts +1 -3
- package/build/ethereum/uiFuncs.js +13 -23
- package/build/ethereum/uiFuncs.js.map +1 -1
- package/build/exception.d.ts +8 -0
- package/build/exception.js +14 -0
- package/build/exception.js.map +1 -0
- package/build/index.d.ts +8 -5
- package/build/index.js +38 -19
- package/build/index.js.map +1 -1
- package/build/memo.js +6 -3
- package/build/memo.js.map +1 -1
- package/build/qr.d.ts +31 -6
- package/build/qr.js +32 -12
- package/build/qr.js.map +1 -1
- package/build/rest/ajaxReq.d.ts +3 -10
- package/build/rest/ajaxReq.js +16 -33
- package/build/rest/ajaxReq.js.map +1 -1
- package/build/rest/http.js +6 -1
- package/build/rest/http.js.map +1 -1
- package/build/rest/serializer.js.map +1 -1
- package/build/type.d.ts +4 -4
- package/build/utils.d.ts +15 -0
- package/build/utils.js +270 -0
- package/build/utils.js.map +1 -0
- package/build/wallet.d.ts +6 -8
- package/build/wallet.js +35 -39
- package/build/wallet.js.map +1 -1
- package/package.json +10 -5
- package/skip-prod-transpilation.ts +48 -0
- package/src/bcRead.ts +184 -63
- package/src/bcTransaction.ts +143 -114
- package/src/config/transactions.ts +30 -0
- package/src/connection.ts +42 -9
- package/src/customization.ts +17 -2
- package/src/ethereum/ethFuncs.ts +42 -1
- package/src/ethereum/etherUnits.ts +5 -5
- package/src/ethereum/uiFuncs.ts +16 -25
- package/src/exception.ts +16 -0
- package/src/index.ts +53 -27
- package/src/qr.ts +86 -12
- package/src/rest/ajaxReq.ts +18 -40
- package/src/utils.ts +300 -0
- package/src/wallet.ts +37 -48
- package/tests/environment.ts +27 -0
- package/tests/setup.ts +12 -0
- package/tsconfig.json +8 -2
- package/vitest.config.ts +14 -0
package/README.md
CHANGED
|
@@ -41,5 +41,15 @@ javascript and transpile on file change with:
|
|
|
41
41
|
|
|
42
42
|
```shell
|
|
43
43
|
## Compile and watch
|
|
44
|
-
npx
|
|
45
|
-
```
|
|
44
|
+
npx tspc -w
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Tests are managed through `vitest`
|
|
48
|
+
|
|
49
|
+
```shell
|
|
50
|
+
## Run test once
|
|
51
|
+
npm run test
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Note that you can also use `npx vitest` command to launch tests in
|
|
55
|
+
watch mode.
|
package/build/bcRead.d.ts
CHANGED
|
@@ -2,14 +2,12 @@ import AjaxReq from './rest/ajaxReq';
|
|
|
2
2
|
export default abstract class BcReadAbstract {
|
|
3
3
|
abstract ajaxReq: AjaxReq;
|
|
4
4
|
abstract contracts: string[];
|
|
5
|
-
getContractStatus(): Promise<
|
|
6
|
-
getTaxAccount(): Promise<
|
|
7
|
-
|
|
8
|
-
getAmount(address: any, walletAddress: any): Promise<
|
|
9
|
-
getAccInfo(address: any, walletAddress: any): Promise<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
getAmountForElement(contract: any, functionAddress: any, callerAddress: any, elementAddress: any): Promise<string>;
|
|
14
|
-
getElementInList(contract: any, mapFunctionAddress: any, amountFunctionAddress: any, callerAddress: any, index: any, list: any, indMin: any): any;
|
|
5
|
+
getContractStatus(): Promise<string>;
|
|
6
|
+
getTaxAccount(): Promise<string>;
|
|
7
|
+
getVersion(): Promise<any>;
|
|
8
|
+
getAmount(address: any, walletAddress: any, blockNb: any): Promise<any>;
|
|
9
|
+
getAccInfo(address: any, walletAddress: any, blockNb: any): Promise<any>;
|
|
10
|
+
read(contract: string, address: string, args?: any[], blockNb?: string | number): Promise<string>;
|
|
11
|
+
getAmountForElement(contract: any, functionAddress: any, callerAddress: any, elementAddress: any, blockNb?: string | number): Promise<any>;
|
|
12
|
+
getElementInList(contract: any, mapFunctionAddress: any, amountFunctionAddress: any, callerAddress: any, index: any, list: any, indMin: any, blockNb?: string | number): any;
|
|
15
13
|
}
|
package/build/bcRead.js
CHANGED
|
@@ -1,68 +1,178 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { getNakedAddress, padLeft, getDataObj } from './ethereum/ethFuncs';
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (a > (34359738368 * 4096)) {
|
|
7
|
-
a -= 68719476736 * 4096;
|
|
3
|
+
function decodeData(abiType, data) {
|
|
4
|
+
if (data.startsWith('0x')) {
|
|
5
|
+
data = data.slice(2);
|
|
8
6
|
}
|
|
9
|
-
|
|
7
|
+
if (data.length === 0) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
let dataBuffer;
|
|
11
|
+
try {
|
|
12
|
+
dataBuffer = Buffer.from(data, 'hex');
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
throw new Error('Invalid data provided: not an hex string');
|
|
16
|
+
}
|
|
17
|
+
if (dataBuffer.length % 32 !== 0) {
|
|
18
|
+
throw new Error('Invalid data provided: data length is not a multiple of 32');
|
|
19
|
+
}
|
|
20
|
+
const uintData = dataBuffer.readUIntBE(0, 32);
|
|
21
|
+
switch (abiType) {
|
|
22
|
+
case 'string':
|
|
23
|
+
const dataLocation = uintData;
|
|
24
|
+
if (dataLocation % 32 !== 0) {
|
|
25
|
+
throw new Error('Invalid data provided while decoding string: ' +
|
|
26
|
+
'first 32byte word is not a valid address');
|
|
27
|
+
}
|
|
28
|
+
if (dataLocation + 64 > dataBuffer.length) {
|
|
29
|
+
throw new Error('Invalid data provided while decoding string: ' +
|
|
30
|
+
'not enough data to decode length and first word at given location');
|
|
31
|
+
}
|
|
32
|
+
const dataLength = dataBuffer.readUIntBE(dataLocation, 32);
|
|
33
|
+
const expectedLength = Math.ceil((dataLocation + 32 + dataLength) / 32) * 32;
|
|
34
|
+
if (dataBuffer.length !== expectedLength) {
|
|
35
|
+
throw new Error('Invalid data provided while decoding string: ' +
|
|
36
|
+
'not enough data to decode advertised string');
|
|
37
|
+
}
|
|
38
|
+
const dataValue = dataBuffer.slice(dataLocation + 32, dataLocation + 32 + dataLength);
|
|
39
|
+
return dataValue.toString();
|
|
40
|
+
case 'uint':
|
|
41
|
+
case 'uint256':
|
|
42
|
+
return uintData;
|
|
43
|
+
case 'number/100':
|
|
44
|
+
// Avoid passing through float and division by 100 to ensure format X...X.YY
|
|
45
|
+
let data_int = decodeData('number', data);
|
|
46
|
+
let sign = "";
|
|
47
|
+
if (data_int < 0) {
|
|
48
|
+
data_int = -data_int;
|
|
49
|
+
sign = "-";
|
|
50
|
+
}
|
|
51
|
+
// garanteed >3 sized string representing uint
|
|
52
|
+
let data_str = data_int.toString().padStart(3, "0");
|
|
53
|
+
return `${sign}${data_str.slice(0, -2)}.${data_str.slice(-2)}`;
|
|
54
|
+
case 'number':
|
|
55
|
+
// Using only 6 bytes, ignoring any upper bytes, this ensures
|
|
56
|
+
// javascript Number type is enough. What is decoded is signed
|
|
57
|
+
// int.
|
|
58
|
+
const shortData = '0x' + data.slice(-12);
|
|
59
|
+
let a = parseInt(shortData, 16);
|
|
60
|
+
if (a > 140737488355328) {
|
|
61
|
+
a -= 281474976710656;
|
|
62
|
+
}
|
|
63
|
+
return a;
|
|
64
|
+
case 'bool':
|
|
65
|
+
return uintData === 1;
|
|
66
|
+
default:
|
|
67
|
+
throw new Error(`Unsupported ABI type: ${abiType}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/* @skip-prod-transpilation */
|
|
71
|
+
if (import.meta.vitest) {
|
|
72
|
+
const { it, expect, describe } = import.meta.vitest;
|
|
73
|
+
describe('decode amounts', () => {
|
|
74
|
+
it('should decode "0x00...0000" to "0.00" (enforce full presence of digit and floating point)', () => {
|
|
75
|
+
expect(decodeData('number/100', '0x0000000000000000000000000000000000000000000000000000000000000000'))
|
|
76
|
+
.toBe('0.00');
|
|
77
|
+
});
|
|
78
|
+
it('should decode "0x00...0001" to "0.01"', () => {
|
|
79
|
+
expect(decodeData('number/100', '0x0000000000000000000000000000000000000000000000000000000000000001'))
|
|
80
|
+
.toBe('0.01');
|
|
81
|
+
});
|
|
82
|
+
it('should decode "0x00...0010" to "0.16"', () => {
|
|
83
|
+
expect(decodeData('number/100', '0x0000000000000000000000000000000000000000000000000000000000000010'))
|
|
84
|
+
.toBe('0.16');
|
|
85
|
+
});
|
|
86
|
+
it('should decode "0x00...1000" to "40.96"', () => {
|
|
87
|
+
expect(decodeData('number/100', '0x0000000000000000000000000000000000000000000000000000000000001000'))
|
|
88
|
+
.toBe('40.96');
|
|
89
|
+
});
|
|
90
|
+
it('should decode 0x00...01_0000_0000_0001 to "0.01" (ignore bytes > 6)', () => {
|
|
91
|
+
expect(decodeData('number/100', '0x0000000000000000000000000000000000000000000000000001000000000001'))
|
|
92
|
+
.toBe('0.01');
|
|
93
|
+
});
|
|
94
|
+
it('should decode 0x00...00_8000_0000_0000 to "1407374883553.28" (max positive number)', () => {
|
|
95
|
+
expect(decodeData('number/100', '0x0000000000000000000000000000000000000000000000000000800000000000'))
|
|
96
|
+
.toBe('1407374883553.28');
|
|
97
|
+
});
|
|
98
|
+
it('should decode 0x00...00_8000_0000_0001 to "-1407374883553.27" (lowest negative number)', () => {
|
|
99
|
+
expect(decodeData('number/100', '0x0000000000000000000000000000000000000000000000000000800000000001'))
|
|
100
|
+
.toBe('-1407374883553.27');
|
|
101
|
+
});
|
|
102
|
+
it('should decode 0x00...00_ffff_ffff_ffff to "-0.01" (max negative number)', () => {
|
|
103
|
+
expect(decodeData('number/100', '0x0000000000000000000000000000000000000000000000000000ffffffffffff'))
|
|
104
|
+
.toBe('-0.01');
|
|
105
|
+
});
|
|
106
|
+
it('should decode "0x00...019a" to "4.10" (enforce 2 digit after floating point)', () => {
|
|
107
|
+
expect(decodeData('number/100', '0x000000000000000000000000000000000000000000000000000000000000019a'))
|
|
108
|
+
.toBe('4.10');
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe('decode strings', () => {
|
|
112
|
+
it('should decode "0x00...020_0...0_" to "2.0"', () => {
|
|
113
|
+
expect(decodeData('string', '0x' +
|
|
114
|
+
'0000000000000000000000000000000000000000000000000000000000000020' + // data location
|
|
115
|
+
'0000000000000000000000000000000000000000000000000000000000000003' + // data length
|
|
116
|
+
'322e300000000000000000000000000000000000000000000000000000000000' // actual string
|
|
117
|
+
)).toBe('2.0');
|
|
118
|
+
});
|
|
119
|
+
});
|
|
10
120
|
}
|
|
11
121
|
export default class BcReadAbstract {
|
|
12
122
|
// Get Global status of the contract
|
|
13
|
-
|
|
123
|
+
getContractStatus() { return this.read(this.contracts[0], '0x8b3c7c69'); }
|
|
14
124
|
// Get Global infos: Tax destinary Account
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
125
|
+
getTaxAccount() { return this.read(this.contracts[0], '0x4f2eabe0'); }
|
|
126
|
+
async getVersion() {
|
|
127
|
+
const data = await this.read(this.contracts[0], '0x54fd4d50');
|
|
128
|
+
return decodeData('string', data);
|
|
19
129
|
}
|
|
20
130
|
// //////////////////////////////////////////////////////////////////////////
|
|
21
131
|
// Generic read function
|
|
22
|
-
async getAmount(address, walletAddress) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
132
|
+
async getAmount(address, walletAddress, blockNb) {
|
|
133
|
+
const data = await this.read(this.contracts[0], address, [
|
|
134
|
+
getNakedAddress(walletAddress)
|
|
135
|
+
], blockNb);
|
|
136
|
+
return decodeData('number/100', data);
|
|
26
137
|
}
|
|
27
|
-
async getAccInfo(address, walletAddress) {
|
|
28
|
-
|
|
138
|
+
async getAccInfo(address, walletAddress, blockNb) {
|
|
139
|
+
const data = await this.read(this.contracts[0], address, [
|
|
140
|
+
getNakedAddress(walletAddress)
|
|
141
|
+
], blockNb);
|
|
142
|
+
return decodeData('number', data);
|
|
29
143
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const data = await this.ajaxReq.getEthCall(userInfo);
|
|
43
|
-
return getNumber(data, 1.0);
|
|
144
|
+
async read(contract, address, args, blockNb = 'pending') {
|
|
145
|
+
args = args || [];
|
|
146
|
+
const ethCall = getDataObj(contract, address, args);
|
|
147
|
+
if (typeof blockNb !== 'string') {
|
|
148
|
+
blockNb = '0x' + new BigNumber(blockNb).toString(16);
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
return (await this.ajaxReq.getEthCallAt(ethCall, blockNb));
|
|
152
|
+
}
|
|
153
|
+
catch (e) {
|
|
154
|
+
throw new Error(`Failed read contract: ${contract}, fn: ${address}`);
|
|
155
|
+
}
|
|
44
156
|
}
|
|
45
|
-
async getAmountForElement(contract, functionAddress, callerAddress, elementAddress) {
|
|
46
|
-
const
|
|
157
|
+
async getAmountForElement(contract, functionAddress, callerAddress, elementAddress, blockNb = 'pending') {
|
|
158
|
+
const data = await this.read(contract, functionAddress, [
|
|
47
159
|
getNakedAddress(callerAddress),
|
|
48
160
|
getNakedAddress(elementAddress)
|
|
49
|
-
]);
|
|
50
|
-
|
|
51
|
-
return getNumber(data, 100.0).toString();
|
|
161
|
+
], blockNb);
|
|
162
|
+
return decodeData('number/100', data);
|
|
52
163
|
}
|
|
53
|
-
async getElementInList(contract, mapFunctionAddress, amountFunctionAddress, callerAddress, index, list, indMin) {
|
|
164
|
+
async getElementInList(contract, mapFunctionAddress, amountFunctionAddress, callerAddress, index, list, indMin, blockNb = 'pending') {
|
|
54
165
|
if (index < indMin)
|
|
55
166
|
return list;
|
|
56
|
-
const
|
|
167
|
+
const data = await this.read(contract, mapFunctionAddress, [
|
|
57
168
|
getNakedAddress(callerAddress),
|
|
58
169
|
padLeft(new BigNumber(index).toString(16), 64)
|
|
59
|
-
]);
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const element = { address: cleanedAdd, amount: amount };
|
|
170
|
+
], blockNb);
|
|
171
|
+
const amount = await this.getAmountForElement(contract, amountFunctionAddress, callerAddress, data, blockNb);
|
|
172
|
+
const address = '0x' + data.substring(data.length - 40);
|
|
173
|
+
const element = { address, amount };
|
|
64
174
|
list.unshift(element);
|
|
65
|
-
return this.getElementInList(contract, mapFunctionAddress, amountFunctionAddress, callerAddress, index - 1, list, indMin);
|
|
175
|
+
return this.getElementInList(contract, mapFunctionAddress, amountFunctionAddress, callerAddress, index - 1, list, indMin, blockNb);
|
|
66
176
|
}
|
|
67
177
|
}
|
|
68
178
|
const fnHashes = [
|
|
@@ -91,8 +201,8 @@ const fnHashes = [
|
|
|
91
201
|
fnHashes.forEach(({ fn, hashes }) => {
|
|
92
202
|
for (const fnName in hashes) {
|
|
93
203
|
const fnHash = hashes[fnName];
|
|
94
|
-
BcReadAbstract.prototype[fnName] = function (walletAddress) {
|
|
95
|
-
return this[fn](fnHash, walletAddress);
|
|
204
|
+
BcReadAbstract.prototype[fnName] = function (walletAddress, blockNb) {
|
|
205
|
+
return this[fn](fnHash, walletAddress, blockNb);
|
|
96
206
|
};
|
|
97
207
|
}
|
|
98
208
|
});
|
|
@@ -109,15 +219,18 @@ const ListFunction = {
|
|
|
109
219
|
for (const key in ListFunction) {
|
|
110
220
|
const configList = ListFunction[key];
|
|
111
221
|
BcReadAbstract.prototype[`get${key}List`] =
|
|
112
|
-
async function (walletAddress, indMin, indMax) {
|
|
222
|
+
async function (walletAddress, indMin, indMax, blockNb = 'pending') {
|
|
113
223
|
// Simple protection against ill inputs on indMin and indMax and to
|
|
114
224
|
// avoid unwanted infinite loops
|
|
115
225
|
indMax = indMax || 0;
|
|
116
226
|
indMin = indMin || 0;
|
|
117
|
-
const
|
|
227
|
+
const data = await this.read(this.contracts[1], `0x${configList.count}`, [
|
|
228
|
+
getNakedAddress(walletAddress)
|
|
229
|
+
], blockNb);
|
|
230
|
+
const count = decodeData('number', data);
|
|
118
231
|
const list = [];
|
|
119
232
|
const index = Math.min(count - 1, indMax);
|
|
120
|
-
return this.getElementInList(this.contracts[1], `0x${configList.map}`, `0x${configList.amount}`, walletAddress, index, list, indMin);
|
|
233
|
+
return this.getElementInList(this.contracts[1], `0x${configList.map}`, `0x${configList.amount}`, walletAddress, index, list, indMin, blockNb);
|
|
121
234
|
};
|
|
122
235
|
}
|
|
123
236
|
//# sourceMappingURL=bcRead.js.map
|
package/build/bcRead.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bcRead.js","sourceRoot":"","sources":["../src/bcRead.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAA;AAGpC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"bcRead.js","sourceRoot":"","sources":["../src/bcRead.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAA;AAGpC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EA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AK,GAAG,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;YACxC,MAAM,IAAI,GAAG,EAAE,CAAA;YACf,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC,CAAA;YACzC,OAAO,IAAI,CAAC,gBAAgB,CAC1B,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EACjB,KAAK,UAAU,CAAC,GAAG,EAAE,EACrB,KAAK,UAAU,CAAC,MAAM,EAAE,EACxB,aAAa,EACb,KAAK,EACL,IAAI,EACJ,MAAM,EACR,OAAO,CAAC,CAAA;QACV,CAAC,CAAA;AACL,CAAC"}
|
package/build/bcTransaction.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import AjaxReq from './rest/ajaxReq';
|
|
2
|
-
export
|
|
2
|
+
export declare abstract class BcTransactionAbstract {
|
|
3
3
|
abstract ajaxReq: AjaxReq;
|
|
4
4
|
abstract contracts: string[];
|
|
5
|
-
getSplitting(
|
|
5
|
+
static getSplitting(nantBal: any, cmBal: any, cmSrcMin: any, amount: any): {
|
|
6
6
|
possible: boolean;
|
|
7
7
|
nant: number;
|
|
8
8
|
cm: number;
|
|
9
|
+
} | {
|
|
10
|
+
possible: boolean;
|
|
11
|
+
nant?: undefined;
|
|
12
|
+
cm?: undefined;
|
|
9
13
|
};
|
|
14
|
+
getSplitting: typeof BcTransactionAbstract.getSplitting;
|
|
10
15
|
}
|
|
16
|
+
export declare function transactionFactory(transactionDefs: any[], bcTransactionClass: any): void;
|