-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmint-sub-account.js
More file actions
33 lines (26 loc) · 925 Bytes
/
mint-sub-account.js
File metadata and controls
33 lines (26 loc) · 925 Bytes
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
const { createInstance, EvmSigner, CoinType } = require('../../lib/index')
const { Wallet, QuickNodeProvider } = require('ethers')
const address = '0x7df93d9F500fD5A9537FEE086322a988D4fDCC38'
const privateKey1 = '87d8a2bccdfc9984295748fa2058136c8131335f59930933e9d4b3e74d4fca42'
const provider = new QuickNodeProvider('holesky')
const wallet = new Wallet(privateKey1, provider)
const signer = new EvmSigner(wallet)
const dotbit = createInstance({
network: 'testnet',
signer,
})
async function main () {
await dotbit.records('imac.bit').then(console.log)
await dotbit.accountInfo('imac.bit').then(console.log)
const account = dotbit.account('imac.bit')
const res = await account.mintSubAccount({
account: '001.imac.bit',
keyInfo: {
coin_type: CoinType.ETH,
key: await wallet.getAddress(), // sub account's owner address
},
registerYears: 1,
})
console.log(res)
}
void main()