@injectivelabs/wallet-evm 1.15.30 → 1.15.32
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/README.md
CHANGED
|
@@ -30,10 +30,9 @@ dependencies and implementations for their specific wallets.
|
|
|
30
30
|
Here's a brief example of how to use this package to send 1 INJ.:
|
|
31
31
|
|
|
32
32
|
```typescript
|
|
33
|
-
import { Wallet } from '@injectivelabs/wallet-base'
|
|
34
|
-
import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core'
|
|
35
|
-
import { EvmWalletStrategy } from '@injectivelabs/wallet-evm'
|
|
36
|
-
|
|
33
|
+
import { Wallet } from '@injectivelabs/wallet-base'
|
|
34
|
+
import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core'
|
|
35
|
+
import { EvmWalletStrategy } from '@injectivelabs/wallet-evm'
|
|
37
36
|
|
|
38
37
|
const strategyArgs: WalletStrategyArguments = {
|
|
39
38
|
chainId: ChainId.Mainnet,
|
|
@@ -56,21 +55,21 @@ const msgBroadcaster = new MsgBroadcaster({
|
|
|
56
55
|
})
|
|
57
56
|
|
|
58
57
|
const sendTX = async () => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
58
|
+
const injectiveAddress = 'someInjectiveAddress'
|
|
59
|
+
|
|
60
|
+
const message = MsgSend.fromJSON({
|
|
61
|
+
srcInjectiveAddress: injectiveAddress,
|
|
62
|
+
dstInjectiveAddress: injectiveAddress,
|
|
63
|
+
amount: {
|
|
64
|
+
amount: '1',
|
|
65
|
+
denom: 'inj',
|
|
66
|
+
},
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
return await msgBroadcaster.broadcast({ msgs: message })
|
|
70
|
+
}
|
|
72
71
|
|
|
73
|
-
|
|
72
|
+
const result = await sendTX()
|
|
74
73
|
```
|
|
75
74
|
|
|
76
75
|
Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy)
|
|
@@ -14,7 +14,7 @@ export declare class EvmWallet extends BaseConcreteStrategy implements ConcreteW
|
|
|
14
14
|
disconnect(): Promise<void>;
|
|
15
15
|
getAddresses(): Promise<string[]>;
|
|
16
16
|
getSessionOrConfirm(address: AccountAddress): Promise<string>;
|
|
17
|
-
|
|
17
|
+
sendEvmTransaction(transaction: unknown, _options: {
|
|
18
18
|
address: AccountAddress;
|
|
19
19
|
ethereumChainId: EthereumChainId;
|
|
20
20
|
}): Promise<string>;
|
|
@@ -32,7 +32,7 @@ export declare class EvmWallet extends BaseConcreteStrategy implements ConcreteW
|
|
|
32
32
|
}): Promise<DirectSignResponse>;
|
|
33
33
|
signArbitrary(signer: AccountAddress, data: string | Uint8Array): Promise<string>;
|
|
34
34
|
getEthereumChainId(): Promise<string>;
|
|
35
|
-
|
|
35
|
+
getEvmTransactionReceipt(txHash: string): Promise<string>;
|
|
36
36
|
getPubKey(): Promise<string>;
|
|
37
37
|
onChainIdChanged(callback: (chain: string) => void): Promise<void>;
|
|
38
38
|
onAccountChange(callback: (account: AccountAddress | string[]) => void): Promise<void>;
|
|
@@ -100,7 +100,7 @@ class EvmWallet extends wallet_base_2.BaseConcreteStrategy {
|
|
|
100
100
|
async getSessionOrConfirm(address) {
|
|
101
101
|
return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
|
|
102
102
|
}
|
|
103
|
-
async
|
|
103
|
+
async sendEvmTransaction(transaction, _options) {
|
|
104
104
|
const ethereum = await this.getEthereum();
|
|
105
105
|
try {
|
|
106
106
|
return (await ethereum.request({
|
|
@@ -112,7 +112,7 @@ class EvmWallet extends wallet_base_2.BaseConcreteStrategy {
|
|
|
112
112
|
throw this.EvmWalletException(new Error(e.message), {
|
|
113
113
|
code: exceptions_1.UnspecifiedErrorCode,
|
|
114
114
|
type: exceptions_1.ErrorType.WalletError,
|
|
115
|
-
contextModule: wallet_base_2.WalletAction.
|
|
115
|
+
contextModule: wallet_base_2.WalletAction.SendEvmTransaction,
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -200,7 +200,7 @@ class EvmWallet extends wallet_base_2.BaseConcreteStrategy {
|
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
async
|
|
203
|
+
async getEvmTransactionReceipt(txHash) {
|
|
204
204
|
const ethereum = await this.getEthereum();
|
|
205
205
|
const interval = 1000;
|
|
206
206
|
const transactionReceiptRetry = async () => {
|
|
@@ -221,7 +221,7 @@ class EvmWallet extends wallet_base_2.BaseConcreteStrategy {
|
|
|
221
221
|
throw this.EvmWalletException(new Error(e.message), {
|
|
222
222
|
code: exceptions_1.UnspecifiedErrorCode,
|
|
223
223
|
type: exceptions_1.ErrorType.WalletError,
|
|
224
|
-
contextModule: wallet_base_2.WalletAction.
|
|
224
|
+
contextModule: wallet_base_2.WalletAction.GetEvmTransactionReceipt,
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
227
|
}
|
|
@@ -14,7 +14,7 @@ export declare class EvmWallet extends BaseConcreteStrategy implements ConcreteW
|
|
|
14
14
|
disconnect(): Promise<void>;
|
|
15
15
|
getAddresses(): Promise<string[]>;
|
|
16
16
|
getSessionOrConfirm(address: AccountAddress): Promise<string>;
|
|
17
|
-
|
|
17
|
+
sendEvmTransaction(transaction: unknown, _options: {
|
|
18
18
|
address: AccountAddress;
|
|
19
19
|
ethereumChainId: EthereumChainId;
|
|
20
20
|
}): Promise<string>;
|
|
@@ -32,7 +32,7 @@ export declare class EvmWallet extends BaseConcreteStrategy implements ConcreteW
|
|
|
32
32
|
}): Promise<DirectSignResponse>;
|
|
33
33
|
signArbitrary(signer: AccountAddress, data: string | Uint8Array): Promise<string>;
|
|
34
34
|
getEthereumChainId(): Promise<string>;
|
|
35
|
-
|
|
35
|
+
getEvmTransactionReceipt(txHash: string): Promise<string>;
|
|
36
36
|
getPubKey(): Promise<string>;
|
|
37
37
|
onChainIdChanged(callback: (chain: string) => void): Promise<void>;
|
|
38
38
|
onAccountChange(callback: (account: AccountAddress | string[]) => void): Promise<void>;
|
|
@@ -97,7 +97,7 @@ export class EvmWallet extends BaseConcreteStrategy {
|
|
|
97
97
|
async getSessionOrConfirm(address) {
|
|
98
98
|
return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
|
|
99
99
|
}
|
|
100
|
-
async
|
|
100
|
+
async sendEvmTransaction(transaction, _options) {
|
|
101
101
|
const ethereum = await this.getEthereum();
|
|
102
102
|
try {
|
|
103
103
|
return (await ethereum.request({
|
|
@@ -109,7 +109,7 @@ export class EvmWallet extends BaseConcreteStrategy {
|
|
|
109
109
|
throw this.EvmWalletException(new Error(e.message), {
|
|
110
110
|
code: UnspecifiedErrorCode,
|
|
111
111
|
type: ErrorType.WalletError,
|
|
112
|
-
contextModule: WalletAction.
|
|
112
|
+
contextModule: WalletAction.SendEvmTransaction,
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -197,7 +197,7 @@ export class EvmWallet extends BaseConcreteStrategy {
|
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
async
|
|
200
|
+
async getEvmTransactionReceipt(txHash) {
|
|
201
201
|
const ethereum = await this.getEthereum();
|
|
202
202
|
const interval = 1000;
|
|
203
203
|
const transactionReceiptRetry = async () => {
|
|
@@ -218,7 +218,7 @@ export class EvmWallet extends BaseConcreteStrategy {
|
|
|
218
218
|
throw this.EvmWalletException(new Error(e.message), {
|
|
219
219
|
code: UnspecifiedErrorCode,
|
|
220
220
|
type: ErrorType.WalletError,
|
|
221
|
-
contextModule: WalletAction.
|
|
221
|
+
contextModule: WalletAction.GetEvmTransactionReceipt,
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-evm",
|
|
3
3
|
"description": "EVM wallet strategies for use with @injectivelabs/wallet-core.",
|
|
4
|
-
"version": "1.15.
|
|
4
|
+
"version": "1.15.32",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": {
|
|
@@ -56,17 +56,17 @@
|
|
|
56
56
|
"start": "node dist/index.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@injectivelabs/exceptions": "^1.15.
|
|
60
|
-
"@injectivelabs/networks": "^1.15.
|
|
61
|
-
"@injectivelabs/sdk-ts": "^1.15.
|
|
62
|
-
"@injectivelabs/ts-types": "^1.15.
|
|
63
|
-
"@injectivelabs/utils": "^1.15.
|
|
64
|
-
"@injectivelabs/wallet-base": "^1.15.
|
|
59
|
+
"@injectivelabs/exceptions": "^1.15.29",
|
|
60
|
+
"@injectivelabs/networks": "^1.15.30",
|
|
61
|
+
"@injectivelabs/sdk-ts": "^1.15.32",
|
|
62
|
+
"@injectivelabs/ts-types": "^1.15.30",
|
|
63
|
+
"@injectivelabs/utils": "^1.15.30",
|
|
64
|
+
"@injectivelabs/wallet-base": "^1.15.32"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"shx": "^0.3.3"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "e8fa12c489c4b3432579c5df30fd6f939d57b442",
|
|
70
70
|
"typedoc": {
|
|
71
71
|
"entryPoint": "./src/index.ts",
|
|
72
72
|
"readmeFile": "./README.md",
|