@zilliqa-js/contract
Advanced tools
Comparing version 3.3.0 to 3.3.1
import { Transaction, Wallet } from '@zilliqa-js/account'; | ||
import { Provider } from '@zilliqa-js/core'; | ||
import { Blockchain } from '@zilliqa-js/blockchain'; | ||
import { Contracts } from './factory'; | ||
@@ -9,2 +10,3 @@ import { ABI, CallParams, ContractStatus, DeployParams, Init, State, Value } from './types'; | ||
signer: Wallet; | ||
blockchain: Blockchain; | ||
init: Init; | ||
@@ -68,9 +70,2 @@ abi?: ABI; | ||
getState(): Promise<State>; | ||
/** | ||
* getSubState | ||
* | ||
* @param { string } variableName - variable name within the state | ||
* @param { string[] } indices - (optional) If the variable is of map type, you can specify an index (or indices) | ||
* @returns {Promise<RPCResponse<any, string>>} | ||
*/ | ||
getSubState(variableName: string, indices?: string[]): Promise<State>; | ||
@@ -77,0 +72,0 @@ getInit(): Promise<State>; |
@@ -25,2 +25,3 @@ "use strict"; | ||
var util_1 = require("@zilliqa-js/util"); | ||
var blockchain_1 = require("@zilliqa-js/blockchain"); | ||
var factory_1 = require("./factory"); | ||
@@ -35,2 +36,3 @@ var types_1 = require("./types"); | ||
this.signer = factory.signer; | ||
this.blockchain = new blockchain_1.Blockchain(factory.provider, factory.signer); | ||
// assume that we are accessing an existing contract | ||
@@ -295,3 +297,2 @@ if (address) { | ||
}; | ||
// FIXME: Link to @zilliqa-js/blockchain package (reuse code) | ||
Contract.prototype.getState = function () { | ||
@@ -309,3 +310,3 @@ return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
} | ||
return [4 /*yield*/, this.provider.send(core_1.RPCMethod.GetSmartContractState, this.address.replace('0x', '').toLowerCase())]; | ||
return [4 /*yield*/, this.blockchain.getSmartContractState(this.address)]; | ||
case 1: | ||
@@ -318,10 +319,2 @@ response = _a.sent(); | ||
}; | ||
// FIXME: Link to @zilliqa-js/blockchain package (reuse code) | ||
/** | ||
* getSubState | ||
* | ||
* @param { string } variableName - variable name within the state | ||
* @param { string[] } indices - (optional) If the variable is of map type, you can specify an index (or indices) | ||
* @returns {Promise<RPCResponse<any, string>>} | ||
*/ | ||
Contract.prototype.getSubState = function (variableName, indices) { | ||
@@ -342,3 +335,3 @@ return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
} | ||
return [4 /*yield*/, this.provider.send(core_1.RPCMethod.GetSmartContractSubState, this.address.replace('0x', '').toLowerCase(), variableName, indices === undefined ? [] : indices)]; | ||
return [4 /*yield*/, this.blockchain.getSmartContractSubState(this.address, variableName, indices)]; | ||
case 1: | ||
@@ -351,3 +344,2 @@ response = _a.sent(); | ||
}; | ||
// FIXME: Link to @zilliqa-js/blockchain package (reuse code) | ||
Contract.prototype.getInit = function () { | ||
@@ -365,3 +357,3 @@ return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
} | ||
return [4 /*yield*/, this.provider.send(core_1.RPCMethod.GetSmartContractInit, this.address.replace('0x', '').toLowerCase())]; | ||
return [4 /*yield*/, this.blockchain.getSmartContractInit(this.address)]; | ||
case 1: | ||
@@ -368,0 +360,0 @@ response = _a.sent(); |
@@ -6,2 +6,3 @@ import { __assign, __awaiter, __decorate, __generator, __metadata } from 'tslib'; | ||
import { BN, validation, bytes } from '@zilliqa-js/util'; | ||
import { Blockchain } from '@zilliqa-js/blockchain'; | ||
import hash from 'hash.js'; | ||
@@ -40,2 +41,3 @@ | ||
this.signer = factory.signer; | ||
this.blockchain = new Blockchain(factory.provider, factory.signer); | ||
// assume that we are accessing an existing contract | ||
@@ -300,3 +302,2 @@ if (address) { | ||
}; | ||
// FIXME: Link to @zilliqa-js/blockchain package (reuse code) | ||
Contract.prototype.getState = function () { | ||
@@ -314,3 +315,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
} | ||
return [4 /*yield*/, this.provider.send(RPCMethod.GetSmartContractState, this.address.replace('0x', '').toLowerCase())]; | ||
return [4 /*yield*/, this.blockchain.getSmartContractState(this.address)]; | ||
case 1: | ||
@@ -323,10 +324,2 @@ response = _a.sent(); | ||
}; | ||
// FIXME: Link to @zilliqa-js/blockchain package (reuse code) | ||
/** | ||
* getSubState | ||
* | ||
* @param { string } variableName - variable name within the state | ||
* @param { string[] } indices - (optional) If the variable is of map type, you can specify an index (or indices) | ||
* @returns {Promise<RPCResponse<any, string>>} | ||
*/ | ||
Contract.prototype.getSubState = function (variableName, indices) { | ||
@@ -347,3 +340,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
} | ||
return [4 /*yield*/, this.provider.send(RPCMethod.GetSmartContractSubState, this.address.replace('0x', '').toLowerCase(), variableName, indices === undefined ? [] : indices)]; | ||
return [4 /*yield*/, this.blockchain.getSmartContractSubState(this.address, variableName, indices)]; | ||
case 1: | ||
@@ -356,3 +349,2 @@ response = _a.sent(); | ||
}; | ||
// FIXME: Link to @zilliqa-js/blockchain package (reuse code) | ||
Contract.prototype.getInit = function () { | ||
@@ -370,3 +362,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
} | ||
return [4 /*yield*/, this.provider.send(RPCMethod.GetSmartContractInit, this.address.replace('0x', '').toLowerCase())]; | ||
return [4 /*yield*/, this.blockchain.getSmartContractInit(this.address)]; | ||
case 1: | ||
@@ -373,0 +365,0 @@ response = _a.sent(); |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('@zilliqa-js/account'), require('@zilliqa-js/core'), require('@zilliqa-js/crypto'), require('@zilliqa-js/util'), require('hash.js')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'tslib', '@zilliqa-js/account', '@zilliqa-js/core', '@zilliqa-js/crypto', '@zilliqa-js/util', 'hash.js'], factory) : | ||
(factory((global.zjsContract = {}),global.tslib,global['@zilliqa-js/account'],global['@zilliqa-js/core'],global['@zilliqa-js/crypto'],global['@zilliqa-js/util'],global.hash.js)); | ||
}(this, (function (exports,tslib,account,core,crypto,util,hash) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('@zilliqa-js/account'), require('@zilliqa-js/core'), require('@zilliqa-js/crypto'), require('@zilliqa-js/util'), require('@zilliqa-js/blockchain'), require('hash.js')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'tslib', '@zilliqa-js/account', '@zilliqa-js/core', '@zilliqa-js/crypto', '@zilliqa-js/util', '@zilliqa-js/blockchain', 'hash.js'], factory) : | ||
(factory((global.zjsContract = {}),global.tslib,global['@zilliqa-js/account'],global['@zilliqa-js/core'],global['@zilliqa-js/crypto'],global['@zilliqa-js/util'],global['@zilliqa-js/blockchain'],global.hash.js)); | ||
}(this, (function (exports,tslib,account,core,crypto,util,blockchain,hash) { 'use strict'; | ||
@@ -24,2 +24,3 @@ hash = hash && hash.hasOwnProperty('default') ? hash['default'] : hash; | ||
this.signer = factory.signer; | ||
this.blockchain = new blockchain.Blockchain(factory.provider, factory.signer); | ||
// assume that we are accessing an existing contract | ||
@@ -284,3 +285,2 @@ if (address) { | ||
}; | ||
// FIXME: Link to @zilliqa-js/blockchain package (reuse code) | ||
Contract.prototype.getState = function () { | ||
@@ -298,3 +298,3 @@ return tslib.__awaiter(this, void 0, void 0, function () { | ||
} | ||
return [4 /*yield*/, this.provider.send(core.RPCMethod.GetSmartContractState, this.address.replace('0x', '').toLowerCase())]; | ||
return [4 /*yield*/, this.blockchain.getSmartContractState(this.address)]; | ||
case 1: | ||
@@ -307,10 +307,2 @@ response = _a.sent(); | ||
}; | ||
// FIXME: Link to @zilliqa-js/blockchain package (reuse code) | ||
/** | ||
* getSubState | ||
* | ||
* @param { string } variableName - variable name within the state | ||
* @param { string[] } indices - (optional) If the variable is of map type, you can specify an index (or indices) | ||
* @returns {Promise<RPCResponse<any, string>>} | ||
*/ | ||
Contract.prototype.getSubState = function (variableName, indices) { | ||
@@ -331,3 +323,3 @@ return tslib.__awaiter(this, void 0, void 0, function () { | ||
} | ||
return [4 /*yield*/, this.provider.send(core.RPCMethod.GetSmartContractSubState, this.address.replace('0x', '').toLowerCase(), variableName, indices === undefined ? [] : indices)]; | ||
return [4 /*yield*/, this.blockchain.getSmartContractSubState(this.address, variableName, indices)]; | ||
case 1: | ||
@@ -340,3 +332,2 @@ response = _a.sent(); | ||
}; | ||
// FIXME: Link to @zilliqa-js/blockchain package (reuse code) | ||
Contract.prototype.getInit = function () { | ||
@@ -354,3 +345,3 @@ return tslib.__awaiter(this, void 0, void 0, function () { | ||
} | ||
return [4 /*yield*/, this.provider.send(core.RPCMethod.GetSmartContractInit, this.address.replace('0x', '').toLowerCase())]; | ||
return [4 /*yield*/, this.blockchain.getSmartContractInit(this.address)]; | ||
case 1: | ||
@@ -357,0 +348,0 @@ response = _a.sent(); |
{ | ||
"name": "@zilliqa-js/contract", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "Contract-related functionality.", | ||
@@ -28,7 +28,7 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@zilliqa-js/account": "3.3.0", | ||
"@zilliqa-js/blockchain": "3.3.0", | ||
"@zilliqa-js/account": "3.3.1", | ||
"@zilliqa-js/blockchain": "3.3.1", | ||
"@zilliqa-js/core": "3.3.0", | ||
"@zilliqa-js/crypto": "3.3.0", | ||
"@zilliqa-js/util": "3.3.0", | ||
"@zilliqa-js/crypto": "3.3.1", | ||
"@zilliqa-js/util": "3.3.1", | ||
"hash.js": "^1.1.5", | ||
@@ -49,3 +49,3 @@ "tslib": "2.3.1", | ||
}, | ||
"gitHead": "b6bf274638c96a3c3d27d6532e21b2ea92aff535" | ||
"gitHead": "b65911489d2552ff28aaa66f2a7882c509c68bf5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174013
1482
+ Added@types/bn.js@5.1.6(transitive)
+ Added@types/elliptic@6.4.18(transitive)
+ Added@types/node@22.10.0(transitive)
+ Added@zilliqa-js/account@3.3.1(transitive)
+ Added@zilliqa-js/blockchain@3.3.1(transitive)
+ Added@zilliqa-js/crypto@3.3.1(transitive)
+ Added@zilliqa-js/util@3.3.1(transitive)
+ Addedundici-types@6.20.0(transitive)
- Removed@types/bn.js@4.11.6(transitive)
- Removed@types/node@22.9.2(transitive)
- Removed@zilliqa-js/account@3.3.0(transitive)
- Removed@zilliqa-js/blockchain@3.3.0(transitive)
- Removed@zilliqa-js/crypto@3.3.0(transitive)
- Removed@zilliqa-js/util@3.3.0(transitive)
- Removedundici-types@6.19.8(transitive)
Updated@zilliqa-js/account@3.3.1
Updated@zilliqa-js/blockchain@3.3.1
Updated@zilliqa-js/crypto@3.3.1
Updated@zilliqa-js/util@3.3.1