@alephium/web3 0.1.0-rc.0 → 0.1.0-rc.3
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/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/api/api-alephium.d.ts +7 -7
- package/dist/src/contract/contract.d.ts +2 -2
- package/dist/src/contract/contract.js +6 -6
- package/dist/src/signer/signer.d.ts +2 -2
- package/package.json +4 -6
- package/src/api/api-alephium.ts +7 -7
- package/src/contract/contract.ts +8 -8
- package/src/signer/signer.ts +2 -2
- package/templates/base/package.json +1 -1
- package/templates/react/package.json +1 -1
|
@@ -35,7 +35,7 @@ export interface AssetOutput {
|
|
|
35
35
|
/** @format 32-byte-hash */
|
|
36
36
|
key: string;
|
|
37
37
|
/** @format uint256 */
|
|
38
|
-
|
|
38
|
+
attoAlphAmount: string;
|
|
39
39
|
/** @format address */
|
|
40
40
|
address: string;
|
|
41
41
|
tokens: Token[];
|
|
@@ -47,7 +47,7 @@ export interface AssetOutput {
|
|
|
47
47
|
}
|
|
48
48
|
export interface AssetState {
|
|
49
49
|
/** @format uint256 */
|
|
50
|
-
|
|
50
|
+
attoAlphAmount: string;
|
|
51
51
|
tokens?: Token[];
|
|
52
52
|
}
|
|
53
53
|
export interface BadRequest {
|
|
@@ -125,7 +125,7 @@ export interface BuildDeployContractTx {
|
|
|
125
125
|
/** @format hex-string */
|
|
126
126
|
bytecode: string;
|
|
127
127
|
/** @format uint256 */
|
|
128
|
-
|
|
128
|
+
initialAttoAlphAmount?: string;
|
|
129
129
|
initialTokenAmounts?: Token[];
|
|
130
130
|
/** @format uint256 */
|
|
131
131
|
issueTokenAmount?: string;
|
|
@@ -153,7 +153,7 @@ export interface BuildExecuteScriptTx {
|
|
|
153
153
|
/** @format hex-string */
|
|
154
154
|
bytecode: string;
|
|
155
155
|
/** @format uint256 */
|
|
156
|
-
|
|
156
|
+
attoAlphAmount?: string;
|
|
157
157
|
tokens?: Token[];
|
|
158
158
|
/** @format gas */
|
|
159
159
|
gasAmount?: number;
|
|
@@ -319,7 +319,7 @@ export interface ContractOutput {
|
|
|
319
319
|
/** @format 32-byte-hash */
|
|
320
320
|
key: string;
|
|
321
321
|
/** @format uint256 */
|
|
322
|
-
|
|
322
|
+
attoAlphAmount: string;
|
|
323
323
|
/** @format address */
|
|
324
324
|
address: string;
|
|
325
325
|
tokens: Token[];
|
|
@@ -349,7 +349,7 @@ export interface Destination {
|
|
|
349
349
|
/** @format address */
|
|
350
350
|
address: string;
|
|
351
351
|
/** @format uint256 */
|
|
352
|
-
|
|
352
|
+
attoAlphAmount: string;
|
|
353
353
|
tokens?: Token[];
|
|
354
354
|
/** @format int64 */
|
|
355
355
|
lockTime?: number;
|
|
@@ -376,7 +376,7 @@ export interface FixedAssetOutput {
|
|
|
376
376
|
/** @format 32-byte-hash */
|
|
377
377
|
key: string;
|
|
378
378
|
/** @format uint256 */
|
|
379
|
-
|
|
379
|
+
attoAlphAmount: string;
|
|
380
380
|
/** @format address */
|
|
381
381
|
address: string;
|
|
382
382
|
tokens: Token[];
|
|
@@ -158,7 +158,7 @@ export interface DeployContractTransaction {
|
|
|
158
158
|
export interface BuildDeployContractTx {
|
|
159
159
|
signerAddress: string;
|
|
160
160
|
initialFields?: Fields;
|
|
161
|
-
|
|
161
|
+
initialAttoAlphAmount?: string;
|
|
162
162
|
initialTokenAmounts?: Token[];
|
|
163
163
|
issueTokenAmount?: Number256;
|
|
164
164
|
gasAmount?: number;
|
|
@@ -168,7 +168,7 @@ export interface BuildDeployContractTx {
|
|
|
168
168
|
export interface BuildExecuteScriptTx {
|
|
169
169
|
signerAddress: string;
|
|
170
170
|
initialFields?: Fields;
|
|
171
|
-
|
|
171
|
+
attoAlphAmount?: Number256;
|
|
172
172
|
tokens?: Token[];
|
|
173
173
|
gasAmount?: number;
|
|
174
174
|
gasPrice?: Number256;
|
|
@@ -364,7 +364,7 @@ class Contract extends Common {
|
|
|
364
364
|
const signerParams = {
|
|
365
365
|
signerAddress: params.signerAddress,
|
|
366
366
|
bytecode: bytecode,
|
|
367
|
-
|
|
367
|
+
initialAttoAlphAmount: extractOptionalNumber256(params.initialAttoAlphAmount),
|
|
368
368
|
issueTokenAmount: extractOptionalNumber256(params.issueTokenAmount),
|
|
369
369
|
initialTokenAmounts: params.initialTokenAmounts?.map(toApiToken),
|
|
370
370
|
gasAmount: params.gasAmount,
|
|
@@ -455,7 +455,7 @@ class Script extends Common {
|
|
|
455
455
|
const signerParams = {
|
|
456
456
|
signerAddress: params.signerAddress,
|
|
457
457
|
bytecode: this.buildByteCodeToDeploy(params.initialFields ? params.initialFields : {}),
|
|
458
|
-
|
|
458
|
+
attoAlphAmount: extractOptionalNumber256(params.attoAlphAmount),
|
|
459
459
|
tokens: typeof params.tokens !== 'undefined' ? params.tokens.map(toApiToken) : undefined,
|
|
460
460
|
gasAmount: params.gasAmount,
|
|
461
461
|
gasPrice: extractOptionalNumber256(params.gasPrice)
|
|
@@ -681,13 +681,13 @@ function fromApiToken(token) {
|
|
|
681
681
|
}
|
|
682
682
|
function toApiAsset(asset) {
|
|
683
683
|
return {
|
|
684
|
-
|
|
684
|
+
attoAlphAmount: extractNumber256(asset.alphAmount),
|
|
685
685
|
tokens: typeof asset.tokens !== 'undefined' ? asset.tokens.map(toApiToken) : []
|
|
686
686
|
};
|
|
687
687
|
}
|
|
688
688
|
function fromApiAsset(asset) {
|
|
689
689
|
return {
|
|
690
|
-
alphAmount: decodeNumber256(asset.
|
|
690
|
+
alphAmount: decodeNumber256(asset.attoAlphAmount),
|
|
691
691
|
tokens: typeof asset.tokens !== 'undefined' ? asset.tokens.map(fromApiToken) : undefined
|
|
692
692
|
};
|
|
693
693
|
}
|
|
@@ -734,7 +734,7 @@ function fromApiOutput(output) {
|
|
|
734
734
|
return {
|
|
735
735
|
type: 'AssetOutput',
|
|
736
736
|
address: asset.address,
|
|
737
|
-
alphAmount: decodeNumber256(asset.
|
|
737
|
+
alphAmount: decodeNumber256(asset.attoAlphAmount),
|
|
738
738
|
tokens: asset.tokens.map(fromApiToken),
|
|
739
739
|
lockTime: asset.lockTime,
|
|
740
740
|
message: asset.message
|
|
@@ -745,7 +745,7 @@ function fromApiOutput(output) {
|
|
|
745
745
|
return {
|
|
746
746
|
type: 'ContractOutput',
|
|
747
747
|
address: asset.address,
|
|
748
|
-
alphAmount: decodeNumber256(asset.
|
|
748
|
+
alphAmount: decodeNumber256(asset.attoAlphAmount),
|
|
749
749
|
tokens: asset.tokens.map(fromApiToken)
|
|
750
750
|
};
|
|
751
751
|
}
|
|
@@ -39,7 +39,7 @@ export interface SignTransferTxResult {
|
|
|
39
39
|
export interface SignDeployContractTxParams {
|
|
40
40
|
signerAddress: string;
|
|
41
41
|
bytecode: string;
|
|
42
|
-
|
|
42
|
+
initialAttoAlphAmount?: string;
|
|
43
43
|
initialTokenAmounts?: Token[];
|
|
44
44
|
issueTokenAmount?: string;
|
|
45
45
|
gasAmount?: number;
|
|
@@ -58,7 +58,7 @@ export interface SignDeployContractTxResult {
|
|
|
58
58
|
export interface SignExecuteScriptTxParams {
|
|
59
59
|
signerAddress: string;
|
|
60
60
|
bytecode: string;
|
|
61
|
-
|
|
61
|
+
attoAlphAmount?: string;
|
|
62
62
|
tokens?: node.Token[];
|
|
63
63
|
gasAmount?: number;
|
|
64
64
|
gasPrice?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alephium/web3",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.3",
|
|
4
4
|
"description": "A JS/TS library to interact with the Alephium platform",
|
|
5
5
|
"license": "GPL",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"author": "Alephium dev <dev@alephium.org>",
|
|
29
29
|
"config": {
|
|
30
|
-
"alephium_version": "1.4.0-
|
|
31
|
-
"explorer_backend_version": "1.7.0-
|
|
30
|
+
"alephium_version": "1.4.0-rc3",
|
|
31
|
+
"explorer_backend_version": "1.7.0-leman2"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "rm -rf dist/* && npx tsc --build . && webpack",
|
|
@@ -59,10 +59,9 @@
|
|
|
59
59
|
"alephium": "dist/scripts/create-project.js"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@scure/bip32": "1.0.1",
|
|
63
62
|
"base-x": "4.0.0",
|
|
64
|
-
"bip39": "3.0.4",
|
|
65
63
|
"blakejs": "1.2.1",
|
|
64
|
+
"buffer": "^6.0.3",
|
|
66
65
|
"commander": "^9.1.0",
|
|
67
66
|
"cross-fetch": "^3.1.5",
|
|
68
67
|
"crypto-js": "4.1.1",
|
|
@@ -83,7 +82,6 @@
|
|
|
83
82
|
"@typescript-eslint/eslint-plugin": "^4.30.0",
|
|
84
83
|
"@typescript-eslint/parser": "^4.30.0",
|
|
85
84
|
"babel-eslint": "^10.1.0",
|
|
86
|
-
"buffer": "^6.0.3",
|
|
87
85
|
"clean-webpack-plugin": "4.0.0",
|
|
88
86
|
"crypto-browserify": "^3.12.0",
|
|
89
87
|
"eslint": "^7.32.0",
|
package/src/api/api-alephium.ts
CHANGED
|
@@ -59,7 +59,7 @@ export interface AssetOutput {
|
|
|
59
59
|
key: string
|
|
60
60
|
|
|
61
61
|
/** @format uint256 */
|
|
62
|
-
|
|
62
|
+
attoAlphAmount: string
|
|
63
63
|
|
|
64
64
|
/** @format address */
|
|
65
65
|
address: string
|
|
@@ -75,7 +75,7 @@ export interface AssetOutput {
|
|
|
75
75
|
|
|
76
76
|
export interface AssetState {
|
|
77
77
|
/** @format uint256 */
|
|
78
|
-
|
|
78
|
+
attoAlphAmount: string
|
|
79
79
|
tokens?: Token[]
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -175,7 +175,7 @@ export interface BuildDeployContractTx {
|
|
|
175
175
|
bytecode: string
|
|
176
176
|
|
|
177
177
|
/** @format uint256 */
|
|
178
|
-
|
|
178
|
+
initialAttoAlphAmount?: string
|
|
179
179
|
initialTokenAmounts?: Token[]
|
|
180
180
|
|
|
181
181
|
/** @format uint256 */
|
|
@@ -214,7 +214,7 @@ export interface BuildExecuteScriptTx {
|
|
|
214
214
|
bytecode: string
|
|
215
215
|
|
|
216
216
|
/** @format uint256 */
|
|
217
|
-
|
|
217
|
+
attoAlphAmount?: string
|
|
218
218
|
tokens?: Token[]
|
|
219
219
|
|
|
220
220
|
/** @format gas */
|
|
@@ -427,7 +427,7 @@ export interface ContractOutput {
|
|
|
427
427
|
key: string
|
|
428
428
|
|
|
429
429
|
/** @format uint256 */
|
|
430
|
-
|
|
430
|
+
attoAlphAmount: string
|
|
431
431
|
|
|
432
432
|
/** @format address */
|
|
433
433
|
address: string
|
|
@@ -466,7 +466,7 @@ export interface Destination {
|
|
|
466
466
|
address: string
|
|
467
467
|
|
|
468
468
|
/** @format uint256 */
|
|
469
|
-
|
|
469
|
+
attoAlphAmount: string
|
|
470
470
|
tokens?: Token[]
|
|
471
471
|
|
|
472
472
|
/** @format int64 */
|
|
@@ -502,7 +502,7 @@ export interface FixedAssetOutput {
|
|
|
502
502
|
key: string
|
|
503
503
|
|
|
504
504
|
/** @format uint256 */
|
|
505
|
-
|
|
505
|
+
attoAlphAmount: string
|
|
506
506
|
|
|
507
507
|
/** @format address */
|
|
508
508
|
address: string
|
package/src/contract/contract.ts
CHANGED
|
@@ -466,7 +466,7 @@ export class Contract extends Common {
|
|
|
466
466
|
const signerParams: SignDeployContractTxParams = {
|
|
467
467
|
signerAddress: params.signerAddress,
|
|
468
468
|
bytecode: bytecode,
|
|
469
|
-
|
|
469
|
+
initialAttoAlphAmount: extractOptionalNumber256(params.initialAttoAlphAmount),
|
|
470
470
|
issueTokenAmount: extractOptionalNumber256(params.issueTokenAmount),
|
|
471
471
|
initialTokenAmounts: params.initialTokenAmounts?.map(toApiToken),
|
|
472
472
|
gasAmount: params.gasAmount,
|
|
@@ -580,7 +580,7 @@ export class Script extends Common {
|
|
|
580
580
|
const signerParams: SignExecuteScriptTxParams = {
|
|
581
581
|
signerAddress: params.signerAddress,
|
|
582
582
|
bytecode: this.buildByteCodeToDeploy(params.initialFields ? params.initialFields : {}),
|
|
583
|
-
|
|
583
|
+
attoAlphAmount: extractOptionalNumber256(params.attoAlphAmount),
|
|
584
584
|
tokens: typeof params.tokens !== 'undefined' ? params.tokens.map(toApiToken) : undefined,
|
|
585
585
|
gasAmount: params.gasAmount,
|
|
586
586
|
gasPrice: extractOptionalNumber256(params.gasPrice)
|
|
@@ -825,14 +825,14 @@ function fromApiToken(token: node.Token): Token {
|
|
|
825
825
|
|
|
826
826
|
function toApiAsset(asset: Asset): node.AssetState {
|
|
827
827
|
return {
|
|
828
|
-
|
|
828
|
+
attoAlphAmount: extractNumber256(asset.alphAmount),
|
|
829
829
|
tokens: typeof asset.tokens !== 'undefined' ? asset.tokens.map(toApiToken) : []
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
832
|
|
|
833
833
|
function fromApiAsset(asset: node.AssetState): Asset {
|
|
834
834
|
return {
|
|
835
|
-
alphAmount: decodeNumber256(asset.
|
|
835
|
+
alphAmount: decodeNumber256(asset.attoAlphAmount),
|
|
836
836
|
tokens: typeof asset.tokens !== 'undefined' ? asset.tokens.map(fromApiToken) : undefined
|
|
837
837
|
}
|
|
838
838
|
}
|
|
@@ -950,7 +950,7 @@ function fromApiOutput(output: node.Output): Output {
|
|
|
950
950
|
return {
|
|
951
951
|
type: 'AssetOutput',
|
|
952
952
|
address: asset.address,
|
|
953
|
-
alphAmount: decodeNumber256(asset.
|
|
953
|
+
alphAmount: decodeNumber256(asset.attoAlphAmount),
|
|
954
954
|
tokens: asset.tokens.map(fromApiToken),
|
|
955
955
|
lockTime: asset.lockTime,
|
|
956
956
|
message: asset.message
|
|
@@ -960,7 +960,7 @@ function fromApiOutput(output: node.Output): Output {
|
|
|
960
960
|
return {
|
|
961
961
|
type: 'ContractOutput',
|
|
962
962
|
address: asset.address,
|
|
963
|
-
alphAmount: decodeNumber256(asset.
|
|
963
|
+
alphAmount: decodeNumber256(asset.attoAlphAmount),
|
|
964
964
|
tokens: asset.tokens.map(fromApiToken)
|
|
965
965
|
}
|
|
966
966
|
} else {
|
|
@@ -986,7 +986,7 @@ type BuildTxParams<T> = Omit<T, 'bytecode'> & { initialFields?: Val[] }
|
|
|
986
986
|
export interface BuildDeployContractTx {
|
|
987
987
|
signerAddress: string
|
|
988
988
|
initialFields?: Fields
|
|
989
|
-
|
|
989
|
+
initialAttoAlphAmount?: string
|
|
990
990
|
initialTokenAmounts?: Token[]
|
|
991
991
|
issueTokenAmount?: Number256
|
|
992
992
|
gasAmount?: number
|
|
@@ -998,7 +998,7 @@ assertType<Eq<keyof BuildDeployContractTx, keyof BuildTxParams<SignDeployContrac
|
|
|
998
998
|
export interface BuildExecuteScriptTx {
|
|
999
999
|
signerAddress: string
|
|
1000
1000
|
initialFields?: Fields
|
|
1001
|
-
|
|
1001
|
+
attoAlphAmount?: Number256
|
|
1002
1002
|
tokens?: Token[]
|
|
1003
1003
|
gasAmount?: number
|
|
1004
1004
|
gasPrice?: Number256
|
package/src/signer/signer.ts
CHANGED
|
@@ -68,7 +68,7 @@ assertType<Eq<SignTransferTxResult, SignResult>>()
|
|
|
68
68
|
export interface SignDeployContractTxParams {
|
|
69
69
|
signerAddress: string
|
|
70
70
|
bytecode: string
|
|
71
|
-
|
|
71
|
+
initialAttoAlphAmount?: string
|
|
72
72
|
initialTokenAmounts?: Token[]
|
|
73
73
|
issueTokenAmount?: string
|
|
74
74
|
gasAmount?: number
|
|
@@ -90,7 +90,7 @@ assertType<Eq<SignDeployContractTxResult, SignResult & { contractId: string; con
|
|
|
90
90
|
export interface SignExecuteScriptTxParams {
|
|
91
91
|
signerAddress: string
|
|
92
92
|
bytecode: string
|
|
93
|
-
|
|
93
|
+
attoAlphAmount?: string
|
|
94
94
|
tokens?: node.Token[]
|
|
95
95
|
gasAmount?: number
|
|
96
96
|
gasPrice?: string
|