-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
46 lines (39 loc) · 1.31 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { Wallet } from '@ethersproject/wallet'
import { createMessageSend } from '@tharsis/transactions'
import {
broadcast,
getSender,
LOCALNET_CHAIN,
LOCALNET_FEE,
signTransactionUsingEIP712,
} from '@hanchon/evmos-ts-wallet'
// LOCALNET_CHAIN.chainId=9000;
// LOCALNET_CHAIN.cosmosChainId="evmos_9000-1"
LOCALNET_CHAIN.cosmosChainId="streakk_9000-4"
LOCALNET_CHAIN.chainId=9000
LOCALNET_FEE.denom="tSTKC"
;(async () => {
console.log("sender:");
const privateMnemonic =
'note meat elegant sweet supply angle palm noodle museum anxiety city sausage access brother gesture badge heavy circle robust bright organ gorilla agree harvest'
const wallet = Wallet.fromMnemonic(privateMnemonic)
console.log("sender:",wallet);
const sender = await getSender(wallet)
console.log("sender:",sender);
const txSimple = createMessageSend(LOCALNET_CHAIN, sender, LOCALNET_FEE, '', {
destinationAddress: 'streakk1lp0mx49rxde83uaycr3z6n54tpyu3acea88ytz',
amount: '1000000000000000000000000',
denom: 'tSTKC',
})
const resMM = await signTransactionUsingEIP712(
wallet,
sender.accountAddress,
txSimple,
)
const broadcastRes = await broadcast(resMM)
if (broadcastRes.tx_response.code === 0) {
console.log('Success',broadcastRes)
} else {
console.log('Error',broadcastRes)
}
})()