@xchainjs/xchain-wallet 0.1.0 → 0.1.2
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/lib/index.esm.js +20 -0
- package/lib/index.js +20 -0
- package/lib/wallet.d.ts +10 -0
- package/package.json +3 -3
package/lib/index.esm.js
CHANGED
|
@@ -12275,6 +12275,26 @@ class Wallet {
|
|
|
12275
12275
|
return client.deposit({ asset, amount, memo, walletIndex, sequence, gasLimit });
|
|
12276
12276
|
});
|
|
12277
12277
|
}
|
|
12278
|
+
/**
|
|
12279
|
+
* Check if an spenderAddress is allowed to spend in name of another address certain asset amount
|
|
12280
|
+
* @param {Asset} asset to check
|
|
12281
|
+
* @param {BaseAmount} amount to check
|
|
12282
|
+
* @param {string} fromAddress owner of the amount asset
|
|
12283
|
+
* @param {string} spenderAddress spender to check if it is allowed to spend
|
|
12284
|
+
* @returns true if the spenderAddress is allowed to spend the amount, otherwise, false
|
|
12285
|
+
* @throws {Error} if asset is a non ERC20 asset
|
|
12286
|
+
*/
|
|
12287
|
+
approve(asset, amount, spenderAddress) {
|
|
12288
|
+
return __awaiter$5(this, void 0, void 0, function* () {
|
|
12289
|
+
const client = this.getClient(asset.chain);
|
|
12290
|
+
if (!('approve' in client))
|
|
12291
|
+
throw Error('Can not make approve over non EVM client');
|
|
12292
|
+
if (asset.chain === asset.ticker)
|
|
12293
|
+
throw Error('Can not make approve over native asset');
|
|
12294
|
+
const contractAddress = getContractAddressFromAsset(asset);
|
|
12295
|
+
return yield client.approve({ contractAddress, amount, spenderAddress });
|
|
12296
|
+
});
|
|
12297
|
+
}
|
|
12278
12298
|
/**
|
|
12279
12299
|
* Check if an spenderAddress is allowed to spend in name of another address certain asset amount
|
|
12280
12300
|
* @param {Asset} asset to check
|
package/lib/index.js
CHANGED
|
@@ -12279,6 +12279,26 @@ class Wallet {
|
|
|
12279
12279
|
return client.deposit({ asset, amount, memo, walletIndex, sequence, gasLimit });
|
|
12280
12280
|
});
|
|
12281
12281
|
}
|
|
12282
|
+
/**
|
|
12283
|
+
* Check if an spenderAddress is allowed to spend in name of another address certain asset amount
|
|
12284
|
+
* @param {Asset} asset to check
|
|
12285
|
+
* @param {BaseAmount} amount to check
|
|
12286
|
+
* @param {string} fromAddress owner of the amount asset
|
|
12287
|
+
* @param {string} spenderAddress spender to check if it is allowed to spend
|
|
12288
|
+
* @returns true if the spenderAddress is allowed to spend the amount, otherwise, false
|
|
12289
|
+
* @throws {Error} if asset is a non ERC20 asset
|
|
12290
|
+
*/
|
|
12291
|
+
approve(asset, amount, spenderAddress) {
|
|
12292
|
+
return __awaiter$5(this, void 0, void 0, function* () {
|
|
12293
|
+
const client = this.getClient(asset.chain);
|
|
12294
|
+
if (!('approve' in client))
|
|
12295
|
+
throw Error('Can not make approve over non EVM client');
|
|
12296
|
+
if (asset.chain === asset.ticker)
|
|
12297
|
+
throw Error('Can not make approve over native asset');
|
|
12298
|
+
const contractAddress = getContractAddressFromAsset(asset);
|
|
12299
|
+
return yield client.approve({ contractAddress, amount, spenderAddress });
|
|
12300
|
+
});
|
|
12301
|
+
}
|
|
12282
12302
|
/**
|
|
12283
12303
|
* Check if an spenderAddress is allowed to spend in name of another address certain asset amount
|
|
12284
12304
|
* @param {Asset} asset to check
|
package/lib/wallet.d.ts
CHANGED
|
@@ -139,6 +139,16 @@ export declare class Wallet {
|
|
|
139
139
|
deposit({ asset, amount, memo, walletIndex, sequence, gasLimit, }: DepositParam & {
|
|
140
140
|
asset: Asset;
|
|
141
141
|
}): Promise<string>;
|
|
142
|
+
/**
|
|
143
|
+
* Check if an spenderAddress is allowed to spend in name of another address certain asset amount
|
|
144
|
+
* @param {Asset} asset to check
|
|
145
|
+
* @param {BaseAmount} amount to check
|
|
146
|
+
* @param {string} fromAddress owner of the amount asset
|
|
147
|
+
* @param {string} spenderAddress spender to check if it is allowed to spend
|
|
148
|
+
* @returns true if the spenderAddress is allowed to spend the amount, otherwise, false
|
|
149
|
+
* @throws {Error} if asset is a non ERC20 asset
|
|
150
|
+
*/
|
|
151
|
+
approve(asset: Asset, amount: BaseAmount, spenderAddress: string): Promise<ethers.providers.TransactionResponse>;
|
|
142
152
|
/**
|
|
143
153
|
* Check if an spenderAddress is allowed to spend in name of another address certain asset amount
|
|
144
154
|
* @param {Asset} asset to check
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-wallet",
|
|
3
3
|
"description": "XChainjs clients wrapper to work with several chains at the same time",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "lib/index.esm.js",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"@xchainjs/xchain-evm": "0.4.4",
|
|
32
32
|
"@xchainjs/xchain-util": "0.13.2",
|
|
33
33
|
"@xchainjs/xchain-client": "0.16.1",
|
|
34
|
+
"@xchainjs/xchain-thorchain": "1.0.0",
|
|
34
35
|
"ethers": "5.6.6"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@xchainjs/xchain-bitcoin": "0.23.10",
|
|
38
39
|
"@xchainjs/xchain-ethereum": "0.31.5",
|
|
39
|
-
"@xchainjs/xchain-
|
|
40
|
-
"@xchainjs/xchain-mayachain": "0.2.14"
|
|
40
|
+
"@xchainjs/xchain-mayachain": "0.2.16"
|
|
41
41
|
}
|
|
42
42
|
}
|