@bitpay-labs/crypto-wallet-core 11.11.5 → 11.11.6
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/package.json +9 -3
- package/ts_build/src/transactions/index.d.ts +1 -1
- package/ts_build/src/transactions/index.d.ts.map +1 -1
- package/ts_build/src/transactions/index.js.map +1 -1
- package/ts_build/src/types/derivation.d.ts +1 -0
- package/ts_build/src/types/derivation.d.ts.map +1 -1
- package/.mocharc.json +0 -6
- package/LICENSE +0 -21
- package/mcr.config.js +0 -17
- package/src/constants/address.ts +0 -7
- package/src/constants/algorithms.ts +0 -9
- package/src/constants/arc.ts +0 -4
- package/src/constants/chains.ts +0 -68
- package/src/constants/feeMinimums.ts +0 -23
- package/src/constants/index.ts +0 -40
- package/src/constants/tokens.ts +0 -233
- package/src/constants/units.ts +0 -311
- package/src/derivation/arb/index.ts +0 -3
- package/src/derivation/base/index.ts +0 -3
- package/src/derivation/bch/index.ts +0 -11
- package/src/derivation/btc/index.ts +0 -68
- package/src/derivation/doge/index.ts +0 -6
- package/src/derivation/eth/index.ts +0 -86
- package/src/derivation/index.ts +0 -140
- package/src/derivation/ltc/index.ts +0 -6
- package/src/derivation/matic/index.ts +0 -3
- package/src/derivation/op/index.ts +0 -3
- package/src/derivation/paths.ts +0 -45
- package/src/derivation/sol/index.ts +0 -81
- package/src/derivation/xrp/index.ts +0 -63
- package/src/index.ts +0 -48
- package/src/message/btc.ts +0 -28
- package/src/message/eth.ts +0 -47
- package/src/message/index.ts +0 -71
- package/src/message/sol.ts +0 -3
- package/src/message/xrp.ts +0 -4
- package/src/transactions/arb/index.ts +0 -14
- package/src/transactions/base/index.ts +0 -13
- package/src/transactions/bch/index.ts +0 -25
- package/src/transactions/btc/index.ts +0 -316
- package/src/transactions/doge/index.ts +0 -31
- package/src/transactions/erc20/abi.ts +0 -418
- package/src/transactions/erc20/index.ts +0 -57
- package/src/transactions/eth/index.ts +0 -192
- package/src/transactions/eth-multisig/abi.ts +0 -724
- package/src/transactions/eth-multisig/index.ts +0 -172
- package/src/transactions/index.ts +0 -85
- package/src/transactions/ltc/index.ts +0 -31
- package/src/transactions/matic/index.ts +0 -14
- package/src/transactions/matic-multisig/index.ts +0 -172
- package/src/transactions/op/index.ts +0 -14
- package/src/transactions/sol/index.ts +0 -306
- package/src/transactions/spl/index.ts +0 -192
- package/src/transactions/xrp/index.ts +0 -167
- package/src/types/derivation.ts +0 -34
- package/src/types/index.ts +0 -3
- package/src/types/message.ts +0 -15
- package/src/types/utils.ts +0 -1
- package/src/types/validation.ts +0 -4
- package/src/utils/bigint.ts +0 -238
- package/src/utils/index.ts +0 -188
- package/src/validation/arb/index.ts +0 -8
- package/src/validation/arc/index.ts +0 -8
- package/src/validation/base/index.ts +0 -8
- package/src/validation/bch/index.ts +0 -17
- package/src/validation/btc/index.ts +0 -17
- package/src/validation/doge/index.ts +0 -16
- package/src/validation/eth/index.ts +0 -29
- package/src/validation/index.ts +0 -45
- package/src/validation/ltc/index.ts +0 -16
- package/src/validation/matic/index.ts +0 -8
- package/src/validation/op/index.ts +0 -8
- package/src/validation/sol/index.ts +0 -34
- package/src/validation/xrp/index.ts +0 -50
- package/test/address.test.ts +0 -190
- package/test/bigint.test.ts +0 -373
- package/test/deriver.test.ts +0 -126
- package/test/transactions.test.ts +0 -2103
- package/test/utils.test.ts +0 -446
- package/test/validation.test.ts +0 -282
- package/tsconfig.json +0 -29
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import Web3 from 'web3';
|
|
2
|
-
import { AbiItem } from 'web3-utils';
|
|
3
|
-
import { ETHTxProvider } from '../eth';
|
|
4
|
-
import { MultisigAbi } from './abi';
|
|
5
|
-
|
|
6
|
-
export class ETHMULTISIGTxProvider extends ETHTxProvider {
|
|
7
|
-
getMultisigContract(multisigContractAddress: string) {
|
|
8
|
-
const web3 = new Web3();
|
|
9
|
-
const contract = new web3.eth.Contract(MultisigAbi as AbiItem[], multisigContractAddress);
|
|
10
|
-
return contract;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
create(params: {
|
|
14
|
-
recipients: Array<{ address: string; amount: string }>;
|
|
15
|
-
nonce: number;
|
|
16
|
-
gasPrice: number;
|
|
17
|
-
data: string;
|
|
18
|
-
gasLimit: number;
|
|
19
|
-
multisigContractAddress: string;
|
|
20
|
-
network: string;
|
|
21
|
-
chainId?: number;
|
|
22
|
-
}) {
|
|
23
|
-
const { multisigContractAddress } = params;
|
|
24
|
-
const recipients = [{ address: multisigContractAddress, amount: '0' }];
|
|
25
|
-
const newParams = { ...params, recipients };
|
|
26
|
-
return super.create(newParams);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
instantiateEncodeData(params: {
|
|
30
|
-
addresses: Array<string>;
|
|
31
|
-
requiredConfirmations: number;
|
|
32
|
-
multisigGnosisContractAddress: string;
|
|
33
|
-
dailyLimit: number;
|
|
34
|
-
}) {
|
|
35
|
-
const { addresses, requiredConfirmations, multisigGnosisContractAddress, dailyLimit } = params;
|
|
36
|
-
const requiredConfirmationsStr = Number(requiredConfirmations).toLocaleString('en', { useGrouping: false });
|
|
37
|
-
const dailyLimitStr = Number(dailyLimit).toLocaleString('en', { useGrouping: false });
|
|
38
|
-
const data = this.getMultisigContract(multisigGnosisContractAddress)
|
|
39
|
-
.methods.create(addresses, requiredConfirmationsStr, dailyLimitStr)
|
|
40
|
-
.encodeABI();
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
addOwnerEncodeData(params: { newOwnerAddress: string; multisigContractAddress: string }) {
|
|
45
|
-
const { multisigContractAddress, newOwnerAddress } = params;
|
|
46
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
47
|
-
.methods.addOwner(newOwnerAddress)
|
|
48
|
-
.encodeABI();
|
|
49
|
-
return this.submitEncodeData({
|
|
50
|
-
recipients: [
|
|
51
|
-
{
|
|
52
|
-
address: multisigContractAddress,
|
|
53
|
-
amount: '0'
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
multisigContractAddress,
|
|
57
|
-
data
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
removeOwnerEncodeData(params: { newOwnerAddress: string; multisigContractAddress: string }) {
|
|
62
|
-
const { multisigContractAddress, newOwnerAddress } = params;
|
|
63
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
64
|
-
.methods.removeOwner(newOwnerAddress)
|
|
65
|
-
.encodeABI();
|
|
66
|
-
return this.submitEncodeData({
|
|
67
|
-
recipients: [
|
|
68
|
-
{
|
|
69
|
-
address: multisigContractAddress,
|
|
70
|
-
amount: '0'
|
|
71
|
-
}
|
|
72
|
-
],
|
|
73
|
-
multisigContractAddress,
|
|
74
|
-
data
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
replaceOwnerEncodeData(params: {
|
|
79
|
-
oldOwnerAddress: string;
|
|
80
|
-
newOwnerAddress: string;
|
|
81
|
-
multisigContractAddress: string;
|
|
82
|
-
}) {
|
|
83
|
-
const { multisigContractAddress, newOwnerAddress, oldOwnerAddress } = params;
|
|
84
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
85
|
-
.methods.removeOwner(oldOwnerAddress, newOwnerAddress)
|
|
86
|
-
.encodeABI();
|
|
87
|
-
return this.submitEncodeData({
|
|
88
|
-
recipients: [
|
|
89
|
-
{
|
|
90
|
-
address: multisigContractAddress,
|
|
91
|
-
amount: '0'
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
multisigContractAddress,
|
|
95
|
-
data
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
changeRequirementEncodedData(params: { requiredConfirmations: number; multisigContractAddress: string }) {
|
|
100
|
-
const { requiredConfirmations, multisigContractAddress } = params;
|
|
101
|
-
const requiredConfirmationsStr = Number(requiredConfirmations).toLocaleString('en', { useGrouping: false });
|
|
102
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
103
|
-
.methods.changeRequirement(requiredConfirmationsStr)
|
|
104
|
-
.encodeABI();
|
|
105
|
-
return this.submitEncodeData({
|
|
106
|
-
recipients: [
|
|
107
|
-
{
|
|
108
|
-
address: multisigContractAddress,
|
|
109
|
-
amount: '0'
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
multisigContractAddress,
|
|
113
|
-
data
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
changeDailyLimitEncodedData(params: { requiredConfirmations: number; multisigContractAddress: string }) {
|
|
118
|
-
const { requiredConfirmations, multisigContractAddress } = params;
|
|
119
|
-
const requiredConfirmationsStr = Number(requiredConfirmations).toLocaleString('en', { useGrouping: false });
|
|
120
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
121
|
-
.methods.changeDailyLimit(requiredConfirmationsStr)
|
|
122
|
-
.encodeABI();
|
|
123
|
-
return this.submitEncodeData({
|
|
124
|
-
recipients: [
|
|
125
|
-
{
|
|
126
|
-
address: multisigContractAddress,
|
|
127
|
-
amount: '0'
|
|
128
|
-
}
|
|
129
|
-
],
|
|
130
|
-
multisigContractAddress,
|
|
131
|
-
data
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
confirmTransactionEncodeData(params: { multisigContractAddress: string; transactionId: number }) {
|
|
136
|
-
const { multisigContractAddress, transactionId } = params;
|
|
137
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
138
|
-
.methods.confirmTransaction(transactionId)
|
|
139
|
-
.encodeABI();
|
|
140
|
-
return data;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
revokeConfirmationEncodeData(params: { multisigContractAddress: string; transactionId: number }) {
|
|
144
|
-
const { multisigContractAddress, transactionId } = params;
|
|
145
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
146
|
-
.methods.revokeConfirmation(transactionId)
|
|
147
|
-
.encodeABI();
|
|
148
|
-
return data;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
executeTransactionEncodeData(params: { multisigContractAddress: string; transactionId: number }) {
|
|
152
|
-
const { multisigContractAddress, transactionId } = params;
|
|
153
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
154
|
-
.methods.executeTransaction(transactionId)
|
|
155
|
-
.encodeABI();
|
|
156
|
-
return data;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// data: It is used to invoke functionalities of a contract and can be left empty ('0x') or bytes(0) for regular value transfers.
|
|
160
|
-
// address: It is used o invoke functionalities of a contract needs to be the address of the Smart Contract whose method you want to invoke.
|
|
161
|
-
submitEncodeData(params: {
|
|
162
|
-
recipients: Array<{ address: string; amount: string }>;
|
|
163
|
-
multisigContractAddress: string;
|
|
164
|
-
data: string;
|
|
165
|
-
}) {
|
|
166
|
-
const { multisigContractAddress, data } = params;
|
|
167
|
-
const [{ address, amount }] = params.recipients;
|
|
168
|
-
const amountStr = Number(amount).toLocaleString('en', { useGrouping: false });
|
|
169
|
-
const contract = this.getMultisigContract(multisigContractAddress);
|
|
170
|
-
return contract.methods.submitTransaction(address, amountStr, data).encodeABI();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ARBERC20TxProvider,
|
|
3
|
-
ARBTxProvider
|
|
4
|
-
} from './arb';
|
|
5
|
-
import {
|
|
6
|
-
BASEERC20TxProvider,
|
|
7
|
-
BASETxProvider
|
|
8
|
-
} from './base';
|
|
9
|
-
import { BCHTxProvider } from './bch';
|
|
10
|
-
import { BTCTxProvider } from './btc';
|
|
11
|
-
import { DOGETxProvider } from './doge';
|
|
12
|
-
import { ERC20TxProvider } from './erc20';
|
|
13
|
-
import { ETHTxProvider } from './eth';
|
|
14
|
-
import { ETHMULTISIGTxProvider } from './eth-multisig';
|
|
15
|
-
import { LTCTxProvider } from './ltc';
|
|
16
|
-
import {
|
|
17
|
-
MATICERC20TxProvider,
|
|
18
|
-
MATICTxProvider
|
|
19
|
-
} from './matic';
|
|
20
|
-
import { MATICMULTISIGTxProvider } from './matic-multisig';
|
|
21
|
-
import { OPERC20TxProvider, OPTxProvider } from './op';
|
|
22
|
-
import { SOLTxProvider } from './sol';
|
|
23
|
-
import { SPLTxProvider } from './spl';
|
|
24
|
-
import { XRPTxProvider } from './xrp';
|
|
25
|
-
|
|
26
|
-
const providers = {
|
|
27
|
-
BTC: new BTCTxProvider(),
|
|
28
|
-
BCH: new BCHTxProvider(),
|
|
29
|
-
ETH: new ETHTxProvider(),
|
|
30
|
-
ETHERC20: new ERC20TxProvider(),
|
|
31
|
-
ETHMULTISIG: new ETHMULTISIGTxProvider(),
|
|
32
|
-
XRP: new XRPTxProvider(),
|
|
33
|
-
DOGE: new DOGETxProvider(),
|
|
34
|
-
LTC: new LTCTxProvider(),
|
|
35
|
-
MATIC: new MATICTxProvider(),
|
|
36
|
-
MATICMULTISIG: new MATICMULTISIGTxProvider(),
|
|
37
|
-
MATICERC20: new MATICERC20TxProvider(),
|
|
38
|
-
ARB: new ARBTxProvider(),
|
|
39
|
-
ARBERC20: new ARBERC20TxProvider(),
|
|
40
|
-
BASE: new BASETxProvider(),
|
|
41
|
-
BASEERC20: new BASEERC20TxProvider(),
|
|
42
|
-
OP: new OPTxProvider(),
|
|
43
|
-
OPERC20: new OPERC20TxProvider(),
|
|
44
|
-
ARC: new ETHTxProvider('ARC'),
|
|
45
|
-
ARCERC20: new ERC20TxProvider('ARC'),
|
|
46
|
-
SOL: new SOLTxProvider(),
|
|
47
|
-
SOLSPL: new SPLTxProvider(),
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export class TransactionsProxy {
|
|
51
|
-
get({ chain }) {
|
|
52
|
-
const normalizedChain = chain.toUpperCase();
|
|
53
|
-
return providers[normalizedChain];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
create(params) {
|
|
57
|
-
return this.get(params).create(params);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
sign(params): string {
|
|
61
|
-
return this.get(params).sign(params);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
getSignature(params): string {
|
|
65
|
-
return this.get(params).getSignature(params);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
applySignature(params) {
|
|
69
|
-
return this.get(params).applySignature(params);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
getHash(params) {
|
|
73
|
-
return this.get(params).getHash(params);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
transformSignatureObject(params) {
|
|
77
|
-
return this.get(params).transformSignatureObject(params);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
getSighash(params): string {
|
|
81
|
-
return this.get(params).getSighash(params);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export default new TransactionsProxy();
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import BitcoreLibLtc from '@bitpay-labs/bitcore-lib-ltc';
|
|
2
|
-
import { BTCTxProvider, EveryUtxoType } from '../btc';
|
|
3
|
-
|
|
4
|
-
export class LTCTxProvider extends BTCTxProvider {
|
|
5
|
-
lib = BitcoreLibLtc;
|
|
6
|
-
create(params: {
|
|
7
|
-
recipients: Array<{ address: string; amount: number | string }>;
|
|
8
|
-
utxos?: EveryUtxoType[];
|
|
9
|
-
change?: string;
|
|
10
|
-
feeRate?: number | string;
|
|
11
|
-
fee?: number | string;
|
|
12
|
-
}): string {
|
|
13
|
-
const { recipients, utxos = [], change, feeRate, fee = 20000 } = params;
|
|
14
|
-
const filteredUtxos = this.selectCoins(recipients, utxos, Number(fee));
|
|
15
|
-
const btcUtxos = filteredUtxos.map(utxo => this.standardizeUtxo(utxo));
|
|
16
|
-
const tx = new this.lib.Transaction().from(btcUtxos);
|
|
17
|
-
if (fee) {
|
|
18
|
-
tx.fee(fee);
|
|
19
|
-
}
|
|
20
|
-
if (feeRate) {
|
|
21
|
-
tx.feePerKb(Number(feeRate) * 1000); // feeRate is in feePerByte
|
|
22
|
-
}
|
|
23
|
-
if (change) {
|
|
24
|
-
tx.change(change);
|
|
25
|
-
}
|
|
26
|
-
for (const recipient of recipients) {
|
|
27
|
-
tx.to(recipient.address, Number(recipient.amount));
|
|
28
|
-
}
|
|
29
|
-
return tx.uncheckedSerialize();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ERC20TxProvider } from '../erc20';
|
|
2
|
-
import { ETHTxProvider } from '../eth';
|
|
3
|
-
|
|
4
|
-
export class MATICTxProvider extends ETHTxProvider {
|
|
5
|
-
constructor() {
|
|
6
|
-
super('MATIC');
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class MATICERC20TxProvider extends ERC20TxProvider {
|
|
11
|
-
constructor() {
|
|
12
|
-
super('MATIC');
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import Web3 from 'web3';
|
|
2
|
-
import { AbiItem } from 'web3-utils';
|
|
3
|
-
import { MultisigAbi } from '../eth-multisig/abi';
|
|
4
|
-
import { MATICTxProvider } from '../matic';
|
|
5
|
-
|
|
6
|
-
export class MATICMULTISIGTxProvider extends MATICTxProvider {
|
|
7
|
-
getMultisigContract(multisigContractAddress: string) {
|
|
8
|
-
const web3 = new Web3();
|
|
9
|
-
const contract = new web3.eth.Contract(MultisigAbi as AbiItem[], multisigContractAddress);
|
|
10
|
-
return contract;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
create(params: {
|
|
14
|
-
recipients: Array<{ address: string; amount: string }>;
|
|
15
|
-
nonce: number;
|
|
16
|
-
gasPrice: number;
|
|
17
|
-
data: string;
|
|
18
|
-
gasLimit: number;
|
|
19
|
-
multisigContractAddress: string;
|
|
20
|
-
network: string;
|
|
21
|
-
chainId?: number;
|
|
22
|
-
}) {
|
|
23
|
-
const { multisigContractAddress } = params;
|
|
24
|
-
const recipients = [{ address: multisigContractAddress, amount: '0' }];
|
|
25
|
-
const newParams = { ...params, recipients };
|
|
26
|
-
return super.create(newParams);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
instantiateEncodeData(params: {
|
|
30
|
-
addresses: Array<string>;
|
|
31
|
-
requiredConfirmations: number;
|
|
32
|
-
multisigGnosisContractAddress: string;
|
|
33
|
-
dailyLimit: number;
|
|
34
|
-
}) {
|
|
35
|
-
const { addresses, requiredConfirmations, multisigGnosisContractAddress, dailyLimit } = params;
|
|
36
|
-
const requiredConfirmationsStr = Number(requiredConfirmations).toLocaleString('en', { useGrouping: false });
|
|
37
|
-
const dailyLimitStr = Number(dailyLimit).toLocaleString('en', { useGrouping: false });
|
|
38
|
-
const data = this.getMultisigContract(multisigGnosisContractAddress)
|
|
39
|
-
.methods.create(addresses, requiredConfirmationsStr, dailyLimitStr)
|
|
40
|
-
.encodeABI();
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
addOwnerEncodeData(params: { newOwnerAddress: string; multisigContractAddress: string }) {
|
|
45
|
-
const { multisigContractAddress, newOwnerAddress } = params;
|
|
46
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
47
|
-
.methods.addOwner(newOwnerAddress)
|
|
48
|
-
.encodeABI();
|
|
49
|
-
return this.submitEncodeData({
|
|
50
|
-
recipients: [
|
|
51
|
-
{
|
|
52
|
-
address: multisigContractAddress,
|
|
53
|
-
amount: '0'
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
multisigContractAddress,
|
|
57
|
-
data
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
removeOwnerEncodeData(params: { newOwnerAddress: string; multisigContractAddress: string }) {
|
|
62
|
-
const { multisigContractAddress, newOwnerAddress } = params;
|
|
63
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
64
|
-
.methods.removeOwner(newOwnerAddress)
|
|
65
|
-
.encodeABI();
|
|
66
|
-
return this.submitEncodeData({
|
|
67
|
-
recipients: [
|
|
68
|
-
{
|
|
69
|
-
address: multisigContractAddress,
|
|
70
|
-
amount: '0'
|
|
71
|
-
}
|
|
72
|
-
],
|
|
73
|
-
multisigContractAddress,
|
|
74
|
-
data
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
replaceOwnerEncodeData(params: {
|
|
79
|
-
oldOwnerAddress: string;
|
|
80
|
-
newOwnerAddress: string;
|
|
81
|
-
multisigContractAddress: string;
|
|
82
|
-
}) {
|
|
83
|
-
const { multisigContractAddress, newOwnerAddress, oldOwnerAddress } = params;
|
|
84
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
85
|
-
.methods.removeOwner(oldOwnerAddress, newOwnerAddress)
|
|
86
|
-
.encodeABI();
|
|
87
|
-
return this.submitEncodeData({
|
|
88
|
-
recipients: [
|
|
89
|
-
{
|
|
90
|
-
address: multisigContractAddress,
|
|
91
|
-
amount: '0'
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
multisigContractAddress,
|
|
95
|
-
data
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
changeRequirementEncodedData(params: { requiredConfirmations: number; multisigContractAddress: string }) {
|
|
100
|
-
const { requiredConfirmations, multisigContractAddress } = params;
|
|
101
|
-
const requiredConfirmationsStr = Number(requiredConfirmations).toLocaleString('en', { useGrouping: false });
|
|
102
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
103
|
-
.methods.changeRequirement(requiredConfirmationsStr)
|
|
104
|
-
.encodeABI();
|
|
105
|
-
return this.submitEncodeData({
|
|
106
|
-
recipients: [
|
|
107
|
-
{
|
|
108
|
-
address: multisigContractAddress,
|
|
109
|
-
amount: '0'
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
multisigContractAddress,
|
|
113
|
-
data
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
changeDailyLimitEncodedData(params: { requiredConfirmations: number; multisigContractAddress: string }) {
|
|
118
|
-
const { requiredConfirmations, multisigContractAddress } = params;
|
|
119
|
-
const requiredConfirmationsStr = Number(requiredConfirmations).toLocaleString('en', { useGrouping: false });
|
|
120
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
121
|
-
.methods.changeDailyLimit(requiredConfirmationsStr)
|
|
122
|
-
.encodeABI();
|
|
123
|
-
return this.submitEncodeData({
|
|
124
|
-
recipients: [
|
|
125
|
-
{
|
|
126
|
-
address: multisigContractAddress,
|
|
127
|
-
amount: '0'
|
|
128
|
-
}
|
|
129
|
-
],
|
|
130
|
-
multisigContractAddress,
|
|
131
|
-
data
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
confirmTransactionEncodeData(params: { multisigContractAddress: string; transactionId: number }) {
|
|
136
|
-
const { multisigContractAddress, transactionId } = params;
|
|
137
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
138
|
-
.methods.confirmTransaction(transactionId)
|
|
139
|
-
.encodeABI();
|
|
140
|
-
return data;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
revokeConfirmationEncodeData(params: { multisigContractAddress: string; transactionId: number }) {
|
|
144
|
-
const { multisigContractAddress, transactionId } = params;
|
|
145
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
146
|
-
.methods.revokeConfirmation(transactionId)
|
|
147
|
-
.encodeABI();
|
|
148
|
-
return data;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
executeTransactionEncodeData(params: { multisigContractAddress: string; transactionId: number }) {
|
|
152
|
-
const { multisigContractAddress, transactionId } = params;
|
|
153
|
-
const data = this.getMultisigContract(multisigContractAddress)
|
|
154
|
-
.methods.executeTransaction(transactionId)
|
|
155
|
-
.encodeABI();
|
|
156
|
-
return data;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// data: It is used to invoke functionalities of a contract and can be left empty ('0x') or bytes(0) for regular value transfers.
|
|
160
|
-
// address: It is used o invoke functionalities of a contract needs to be the address of the Smart Contract whose method you want to invoke.
|
|
161
|
-
submitEncodeData(params: {
|
|
162
|
-
recipients: Array<{ address: string; amount: string }>;
|
|
163
|
-
multisigContractAddress: string;
|
|
164
|
-
data: string;
|
|
165
|
-
}) {
|
|
166
|
-
const { multisigContractAddress, data } = params;
|
|
167
|
-
const [{ address, amount }] = params.recipients;
|
|
168
|
-
const amountStr = Number(amount).toLocaleString('en', { useGrouping: false });
|
|
169
|
-
const contract = this.getMultisigContract(multisigContractAddress);
|
|
170
|
-
return contract.methods.submitTransaction(address, amountStr, data).encodeABI();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ERC20TxProvider } from '../erc20';
|
|
2
|
-
import { ETHTxProvider } from '../eth';
|
|
3
|
-
|
|
4
|
-
export class OPTxProvider extends ETHTxProvider {
|
|
5
|
-
constructor(chain = 'OP') {
|
|
6
|
-
super(chain);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class OPERC20TxProvider extends ERC20TxProvider {
|
|
11
|
-
constructor(chain = 'OP') {
|
|
12
|
-
super(chain);
|
|
13
|
-
}
|
|
14
|
-
}
|