@celo/contractkit
Advanced tools
Comparing version 5.2.0 to 5.2.1-beta.0
# @celo/contractkit | ||
## 5.2.1-beta.0 | ||
### Patch Changes | ||
- 88e3788b8: add notice that LockedGold.getTotalPendingWithdrawalsCount is not yet available on all networks | ||
- 70f600bb0: Mark MetaTransactionWallet and MetaTransactionWalletDeployer as deprecated, including functions to get them and their wrappers. see https://github.com/celo-org/celo-monorepo/issues/10766 | ||
- 2985f9eb2: Refactor Accounts.getParsedSignatureOfAddress | ||
## 5.2.0 | ||
@@ -4,0 +12,0 @@ |
@@ -5,8 +5,2 @@ # Developer Guide | ||
To run test, we first need to generate a devchain snapshot: | ||
`yarn test:reset` | ||
and then: | ||
`yarn test` | ||
@@ -16,3 +10,3 @@ | ||
The tests include an in-memory mock implementation which tests a majority of the functionality. In the case that changes are made to any of the wallet/signing logic, the HSM signer should be tested end-to-end by using an Azure KeyVault. To test against the KeyVault, environment variables are used to provide the client ID and client secret for authentication. Please see the .env file for the required variables. After deploying your KeyVault and generating an ECDSA-SECP256k1 key, you must create a service principal account and provide it signing access to the KeyVault. Instructions on how to do this can be found here: https://www.npmjs.com/package/@azure/keyvault-keys#configuring-your-key-vault. If the .env variables are specified, the tests will automatically switch from using the mock client to the actual KeyVault. | ||
The tests include an in-memory mock implementation which tests a majority of the functionality. In the case that changes are made to any of the wallet/signing logic, the HSM signer should be tested end-to-end by using an Azure KeyVault. To test against the KeyVault, environment variables are used to provide the client ID and client secret for authentication. Please see the .env file for the required variables. After deploying your KeyVault and generating an ECDSA-SECP256k1 key, you must create a service principal account and provide it signing access to the KeyVault. Instructions on how to do this can be found here: <https://www.npmjs.com/package/@azure/keyvault-keys#configuring-your-key-vault>. If the .env variables are specified, the tests will automatically switch from using the mock client to the actual KeyVault. | ||
@@ -22,2 +16,3 @@ ## Testing Ledger Signer | ||
Similarly, the tests include an in-memory mock implementation of the Ledger signer. To run the tests using an actual Ledger device: | ||
- Set `USE_PHYSICAL_LEDGER` to `true` in ledger-wallet.test.ts | ||
@@ -34,2 +29,2 @@ - Install libusb-dev `apt-get install lsb-release libudev-dev libusb-dev libusb-1.0-0 -y` | ||
To customize this generation, see the [linkdocs](./scripts/linkdocs.ts) script. | ||
To customize this generation, see the [linkdocs](./scripts/linkdocs.ts) script. |
@@ -176,5 +176,11 @@ "use strict"; | ||
}; | ||
/* | ||
@deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
WrapperCache.prototype.getMetaTransactionWallet = function (address) { | ||
return this.getContract(base_1.CeloContract.MetaTransactionWallet, address); | ||
}; | ||
/* | ||
@deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
WrapperCache.prototype.getMetaTransactionWalletDeployer = function (address) { | ||
@@ -181,0 +187,0 @@ return this.getContract(base_1.CeloContract.MetaTransactionWalletDeployer, address); |
@@ -72,2 +72,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var chainDataPath; | ||
return __generator(this, function (_a) { | ||
@@ -77,6 +78,9 @@ switch (_a.label) { | ||
console.log('\nstarting ganache...'); | ||
return [4 /*yield*/, (0, ganache_setup_1.default)(path.resolve(path.join(__dirname, '../..')), '.tmp/devchain.tar.gz', { | ||
chainDataPath = path.join(path.dirname(require.resolve('@celo/celo-devchain')), '../chains'); | ||
// v10 refers to core contract release 10 | ||
return [4 /*yield*/, (0, ganache_setup_1.default)(path.resolve(chainDataPath), 'v10.tar.gz', { | ||
from_targz: true, | ||
})]; | ||
case 1: | ||
// v10 refers to core contract release 10 | ||
_a.sent(); | ||
@@ -83,0 +87,0 @@ return [4 /*yield*/, (0, network_1.waitForPortOpen)('localhost', 8545, 60)]; |
@@ -202,5 +202,11 @@ "use strict"; | ||
}; | ||
/* | ||
@deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
Web3ContractCache.prototype.getMetaTransactionWallet = function (address) { | ||
return this.getContract(base_1.CeloContract.MetaTransactionWallet, address); | ||
}; | ||
/* | ||
@deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
Web3ContractCache.prototype.getMetaTransactionWalletDeployer = function (address) { | ||
@@ -207,0 +213,0 @@ return this.getContract(base_1.CeloContract.MetaTransactionWalletDeployer, address); |
@@ -201,7 +201,3 @@ import { Signature } from '@celo/base/lib/signatureUtils'; | ||
0: string; | ||
1: string; /** | ||
* Returns the validator signer for the specified account. | ||
* @param account The address of the account. | ||
* @return The address with which the account can register a validator or group. | ||
*/ | ||
1: string; | ||
}>; | ||
@@ -208,0 +204,0 @@ /** |
@@ -60,2 +60,3 @@ "use strict"; | ||
var typed_data_constructors_1 = require("@celo/utils/lib/typed-data-constructors"); | ||
var getParsedSignatureOfAddress_1 = require("../utils/getParsedSignatureOfAddress"); | ||
var versions_1 = require("../versions"); | ||
@@ -458,12 +459,4 @@ var BaseWrapper_1 = require("../wrappers/BaseWrapper"); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var hash, signature; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
hash = (0, solidity_1.soliditySha3)({ type: 'address', value: address }); | ||
return [4 /*yield*/, signerFn.sign(hash)]; | ||
case 1: | ||
signature = _a.sent(); | ||
return [2 /*return*/, (0, signatureUtils_2.parseSignature)(hash, signature, signer)]; | ||
} | ||
return [2 /*return*/, (0, getParsedSignatureOfAddress_1.getParsedSignatureOfAddress)(solidity_1.soliditySha3, signerFn.sign, address, signer)]; | ||
}); | ||
@@ -470,0 +463,0 @@ }); |
@@ -169,7 +169,9 @@ import { AddressListItem as ALI } from '@celo/base/lib/collections'; | ||
* @param account The account. | ||
* @notice This method is only available in version 1.1.4 or higher of the LockedGold contract. | ||
* @returns The count of pending withdrawals. | ||
*/ | ||
getTotalPendingWithdrawalsCount: (account: string) => Promise<BigNumber>; | ||
getTotalPendingWithdrawalsCount(account: string): Promise<BigNumber>; | ||
_getTotalPendingWithdrawalsCount: (account: string) => Promise<BigNumber>; | ||
} | ||
export declare type LockedGoldWrapperType = LockedGoldWrapper; | ||
export {}; |
@@ -71,2 +71,3 @@ "use strict"; | ||
var bignumber_js_1 = __importDefault(require("bignumber.js")); | ||
var versions_1 = require("../versions"); | ||
var BaseWrapper_1 = require("../wrappers/BaseWrapper"); | ||
@@ -180,8 +181,3 @@ var BaseWrapperForGoverning_1 = require("./BaseWrapperForGoverning"); | ||
_this.getAccountNonvotingLockedGold = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.getAccountNonvotingLockedGold, undefined, BaseWrapper_1.valueToBigNumber); | ||
/** | ||
* Returns the number of pending withdrawals for the specified account. | ||
* @param account The account. | ||
* @returns The count of pending withdrawals. | ||
*/ | ||
_this.getTotalPendingWithdrawalsCount = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.getTotalPendingWithdrawalsCount, undefined, BaseWrapper_1.valueToBigNumber); | ||
_this._getTotalPendingWithdrawalsCount = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.getTotalPendingWithdrawalsCount, undefined, BaseWrapper_1.valueToBigNumber); | ||
return _this; | ||
@@ -521,2 +517,29 @@ } | ||
}; | ||
/** | ||
* Returns the number of pending withdrawals for the specified account. | ||
* @param account The account. | ||
* @notice This method is only available in version 1.1.4 or higher of the LockedGold contract. | ||
* @returns The count of pending withdrawals. | ||
*/ | ||
LockedGoldWrapper.prototype.getTotalPendingWithdrawalsCount = function (account) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var minVersion, version; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
minVersion = new versions_1.ContractVersion(1, 1, 4, 0); | ||
return [4 /*yield*/, this.version()]; | ||
case 1: | ||
version = _a.sent(); | ||
if (version.isAtLeast(minVersion)) { | ||
return [2 /*return*/, this._getTotalPendingWithdrawalsCount(account)]; | ||
} | ||
else { | ||
throw new Error("getTotalPendingWithdrawalsCount not implemented for LockedGold version (".concat(version.toString(), ") deployed to this chain")); | ||
} | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return LockedGoldWrapper; | ||
@@ -523,0 +546,0 @@ }(BaseWrapperForGoverning_1.BaseWrapperForGoverning)); |
@@ -20,2 +20,3 @@ import { Address } from '@celo/base/lib/address'; | ||
* Class that wraps the MetaTransactionWallet | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -27,2 +28,3 @@ export declare class MetaTransactionWalletWrapper extends BaseWrapper<MetaTransactionWallet> { | ||
* @param tx a TransactionInput | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -34,2 +36,3 @@ executeTransaction(tx: TransactionInput<any>): CeloTransactionObject<string>; | ||
* @param txs An array of TransactionInput | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -45,2 +48,3 @@ executeTransactions(txs: Array<TransactionInput<any>>): CeloTransactionObject<{ | ||
* @param signature a Signature | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -53,2 +57,3 @@ executeMetaTransaction(tx: TransactionInput<any>, signature: Signature): CeloTransactionObject<string>; | ||
* @returns signature a Signature | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -60,2 +65,3 @@ signMetaTransaction(tx: TransactionInput<any>, nonce?: number): Promise<Signature>; | ||
* @param tx a TransactionInput | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -62,0 +68,0 @@ signAndExecuteMetaTransaction(tx: TransactionInput<any>): Promise<CeloTransactionObject<string>>; |
@@ -71,2 +71,3 @@ "use strict"; | ||
* Class that wraps the MetaTransactionWallet | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -81,2 +82,5 @@ var MetaTransactionWalletWrapper = /** @class */ (function (_super) { | ||
}; | ||
/* | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
_this.getMetaTransactionDigest = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.getMetaTransactionDigest, _this.getMetaTransactionDigestParams, BaseWrapper_1.stringIdentity); | ||
@@ -95,9 +99,30 @@ _this.getMetaTransactionSignerParams = function (tx, nonce, signature) { | ||
}; | ||
/* | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
_this.getMetaTransactionSigner = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.getMetaTransactionSigner, _this.getMetaTransactionSignerParams, BaseWrapper_1.stringIdentity); | ||
/* | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
_this.eip712DomainSeparator = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.eip712DomainSeparator); | ||
/* | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
_this.isOwner = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.isOwner); | ||
/* | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
_this.nonce = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.nonce, undefined, BaseWrapper_1.valueToInt); | ||
_this.getSigner = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.signer, undefined, BaseWrapper_1.stringIdentity); | ||
/* | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
_this.transferOwnership = (0, BaseWrapper_1.proxySend)(_this.connection, _this.contract.methods.transferOwnership); | ||
/* | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
_this.setSigner = (0, BaseWrapper_1.proxySend)(_this.connection, _this.contract.methods.setSigner); | ||
/* | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
_this.setEip712DomainSeparator = (0, BaseWrapper_1.proxySend)(_this.connection, _this.contract.methods.setEip712DomainSeparator); | ||
@@ -110,2 +135,3 @@ return _this; | ||
* @param tx a TransactionInput | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -120,2 +146,3 @@ MetaTransactionWalletWrapper.prototype.executeTransaction = function (tx) { | ||
* @param txs An array of TransactionInput | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -131,2 +158,3 @@ MetaTransactionWalletWrapper.prototype.executeTransactions = function (txs) { | ||
* @param signature a Signature | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -142,2 +170,3 @@ MetaTransactionWalletWrapper.prototype.executeMetaTransaction = function (tx, signature) { | ||
* @returns signature a Signature | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -175,2 +204,3 @@ MetaTransactionWalletWrapper.prototype.signMetaTransaction = function (tx, nonce) { | ||
* @param tx a TransactionInput | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
@@ -177,0 +207,0 @@ MetaTransactionWalletWrapper.prototype.signAndExecuteMetaTransaction = function (tx) { |
@@ -20,2 +20,5 @@ "use strict"; | ||
var BaseWrapper_1 = require("./BaseWrapper"); | ||
/* | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
var MetaTransactionWalletDeployerWrapper = /** @class */ (function (_super) { | ||
@@ -25,2 +28,5 @@ __extends(MetaTransactionWalletDeployerWrapper, _super); | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
/* | ||
* @deprecated https://github.com/celo-org/celo-monorepo/issues/10766 | ||
*/ | ||
_this.deploy = (0, BaseWrapper_1.proxySend)(_this.connection, _this.contract.methods.deploy); | ||
@@ -27,0 +33,0 @@ return _this; |
{ | ||
"name": "@celo/contractkit", | ||
"version": "5.2.0", | ||
"version": "5.2.1-beta.0", | ||
"description": "Celo's ContractKit to interact with Celo network", | ||
@@ -26,4 +26,2 @@ "main": "./lib/index.js", | ||
"docs": "typedoc", | ||
"test:reset": "yarn --cwd ../../protocol devchain:reset --migration_override ../../dev-utils/src/migration-override.json", | ||
"test:livechain": "yarn --cwd ../../protocol devchain run-tar .tmp/devchain.tar.gz", | ||
"test": "jest --runInBand --forceExit", | ||
@@ -49,2 +47,3 @@ "lint": "tslint -c tslint.json --project ." | ||
"devDependencies": { | ||
"@celo/celo-devchain": "^6.0.3-beta.1", | ||
"@celo/odis-identifiers": "^1.0.0", | ||
@@ -51,0 +50,0 @@ "@celo/dev-utils": "0.0.1", |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
1672455
211
41089
13
1