@alephium/web3 1.1.2 → 1.2.1-rc.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/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/address/address.d.ts +1 -0
- package/dist/src/address/address.js +11 -1
- package/dist/src/api/api-alephium.d.ts +37 -2
- package/dist/src/api/api-alephium.js +17 -1
- package/dist/src/api/api-explorer.d.ts +814 -641
- package/dist/src/api/api-explorer.js +337 -310
- package/dist/src/contract/contract.d.ts +15 -3
- package/dist/src/contract/contract.js +36 -14
- package/package.json +3 -3
- package/src/address/address.ts +9 -0
- package/src/api/api-alephium.ts +51 -3
- package/src/api/api-explorer.ts +1022 -846
- package/src/contract/contract.ts +59 -17
- package/std/nft_interface.ral +20 -1
|
@@ -6,6 +6,7 @@ export declare enum AddressType {
|
|
|
6
6
|
P2C = 3
|
|
7
7
|
}
|
|
8
8
|
export declare function validateAddress(address: string): void;
|
|
9
|
+
export declare function isValidAddress(address: string): boolean;
|
|
9
10
|
export declare function isAssetAddress(address: string): boolean;
|
|
10
11
|
export declare function isContractAddress(address: string): boolean;
|
|
11
12
|
export declare function groupOfAddress(address: string): number;
|
|
@@ -20,7 +20,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.xorByte = exports.subContractId = exports.contractIdFromTx = exports.addressFromTokenId = exports.addressFromContractId = exports.addressFromScript = exports.addressFromPublicKey = exports.publicKeyFromPrivateKey = exports.groupOfPrivateKey = exports.tokenIdFromAddress = exports.contractIdFromAddress = exports.groupOfAddress = exports.isContractAddress = exports.isAssetAddress = exports.validateAddress = exports.AddressType = void 0;
|
|
23
|
+
exports.xorByte = exports.subContractId = exports.contractIdFromTx = exports.addressFromTokenId = exports.addressFromContractId = exports.addressFromScript = exports.addressFromPublicKey = exports.publicKeyFromPrivateKey = exports.groupOfPrivateKey = exports.tokenIdFromAddress = exports.contractIdFromAddress = exports.groupOfAddress = exports.isContractAddress = exports.isAssetAddress = exports.isValidAddress = exports.validateAddress = exports.AddressType = void 0;
|
|
24
24
|
const elliptic_1 = require("elliptic");
|
|
25
25
|
const bn_js_1 = __importDefault(require("bn.js"));
|
|
26
26
|
const constants_1 = require("../constants");
|
|
@@ -43,6 +43,16 @@ function validateAddress(address) {
|
|
|
43
43
|
decodeAndValidateAddress(address);
|
|
44
44
|
}
|
|
45
45
|
exports.validateAddress = validateAddress;
|
|
46
|
+
function isValidAddress(address) {
|
|
47
|
+
try {
|
|
48
|
+
validateAddress(address);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.isValidAddress = isValidAddress;
|
|
46
56
|
function decodeAndValidateAddress(address) {
|
|
47
57
|
let decoded;
|
|
48
58
|
try {
|
|
@@ -359,7 +359,7 @@ export interface CallContract {
|
|
|
359
359
|
/** @format int32 */
|
|
360
360
|
methodIndex: number;
|
|
361
361
|
args?: Val[];
|
|
362
|
-
|
|
362
|
+
interestedContracts?: string[];
|
|
363
363
|
inputAssets?: TestInputAsset[];
|
|
364
364
|
}
|
|
365
365
|
/** CallContractFailed */
|
|
@@ -381,6 +381,32 @@ export interface CallContractSucceeded {
|
|
|
381
381
|
debugMessages: DebugMessage[];
|
|
382
382
|
type: string;
|
|
383
383
|
}
|
|
384
|
+
/** CallTxScript */
|
|
385
|
+
export interface CallTxScript {
|
|
386
|
+
/** @format int32 */
|
|
387
|
+
group: number;
|
|
388
|
+
/** @format hex-string */
|
|
389
|
+
bytecode: string;
|
|
390
|
+
/** @format address */
|
|
391
|
+
callerAddress?: string;
|
|
392
|
+
/** @format block-hash */
|
|
393
|
+
worldStateBlockHash?: string;
|
|
394
|
+
/** @format 32-byte-hash */
|
|
395
|
+
txId?: string;
|
|
396
|
+
inputAssets?: TestInputAsset[];
|
|
397
|
+
interestedContracts?: string[];
|
|
398
|
+
}
|
|
399
|
+
/** CallTxScriptResult */
|
|
400
|
+
export interface CallTxScriptResult {
|
|
401
|
+
returns: Val[];
|
|
402
|
+
/** @format int32 */
|
|
403
|
+
gasUsed: number;
|
|
404
|
+
contracts: ContractState[];
|
|
405
|
+
txInputs: string[];
|
|
406
|
+
txOutputs: Output[];
|
|
407
|
+
events: ContractEventByTxId[];
|
|
408
|
+
debugMessages: DebugMessage[];
|
|
409
|
+
}
|
|
384
410
|
/** ChainInfo */
|
|
385
411
|
export interface ChainInfo {
|
|
386
412
|
/** @format int32 */
|
|
@@ -1153,7 +1179,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
1153
1179
|
}
|
|
1154
1180
|
/**
|
|
1155
1181
|
* @title Alephium API
|
|
1156
|
-
* @version 3.
|
|
1182
|
+
* @version 3.3.0
|
|
1157
1183
|
* @baseUrl ../
|
|
1158
1184
|
*/
|
|
1159
1185
|
export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
@@ -1820,6 +1846,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1820
1846
|
* @request POST:/contracts/multicall-contract
|
|
1821
1847
|
*/
|
|
1822
1848
|
postContractsMulticallContract: (data: MultipleCallContract, params?: RequestParams) => Promise<MultipleCallContractResult>;
|
|
1849
|
+
/**
|
|
1850
|
+
* No description
|
|
1851
|
+
*
|
|
1852
|
+
* @tags Contracts
|
|
1853
|
+
* @name PostContractsCallTxScript
|
|
1854
|
+
* @summary Call TxScript
|
|
1855
|
+
* @request POST:/contracts/call-tx-script
|
|
1856
|
+
*/
|
|
1857
|
+
postContractsCallTxScript: (data: CallTxScript, params?: RequestParams) => Promise<CallTxScriptResult>;
|
|
1823
1858
|
};
|
|
1824
1859
|
multisig: {
|
|
1825
1860
|
/**
|
|
@@ -151,7 +151,7 @@ class HttpClient {
|
|
|
151
151
|
exports.HttpClient = HttpClient;
|
|
152
152
|
/**
|
|
153
153
|
* @title Alephium API
|
|
154
|
-
* @version 3.
|
|
154
|
+
* @version 3.3.0
|
|
155
155
|
* @baseUrl ../
|
|
156
156
|
*/
|
|
157
157
|
class Api extends HttpClient {
|
|
@@ -1118,6 +1118,22 @@ class Api extends HttpClient {
|
|
|
1118
1118
|
type: ContentType.Json,
|
|
1119
1119
|
format: 'json',
|
|
1120
1120
|
...params
|
|
1121
|
+
}).then(utils_1.convertHttpResponse),
|
|
1122
|
+
/**
|
|
1123
|
+
* No description
|
|
1124
|
+
*
|
|
1125
|
+
* @tags Contracts
|
|
1126
|
+
* @name PostContractsCallTxScript
|
|
1127
|
+
* @summary Call TxScript
|
|
1128
|
+
* @request POST:/contracts/call-tx-script
|
|
1129
|
+
*/
|
|
1130
|
+
postContractsCallTxScript: (data, params = {}) => this.request({
|
|
1131
|
+
path: `/contracts/call-tx-script`,
|
|
1132
|
+
method: 'POST',
|
|
1133
|
+
body: data,
|
|
1134
|
+
type: ContentType.Json,
|
|
1135
|
+
format: 'json',
|
|
1136
|
+
...params
|
|
1121
1137
|
}).then(utils_1.convertHttpResponse)
|
|
1122
1138
|
};
|
|
1123
1139
|
this.multisig = {
|