-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
Since this is not a stable/critical issue, create a backlog here:
/* eslint no-console:"off" */
const { fromRandom, WalletType } = require('@arcblock/forge-wallet');
const Mcrypto = require('@arcblock/mcrypto');
const { hexToBytes } = require('@arcblock/forge-util');
const GraphqlClient = require('@arcblock/forge-graphql-client');
const client = new GraphqlClient('http://localhost:8210/api'); // local
const type = WalletType({
role: Mcrypto.types.RoleType.ROLE_ACCOUNT,
// pk: Mcrypto.types.KeyType.ED25519,
pk: Mcrypto.types.KeyType.SECP256K1,
hash: Mcrypto.types.HashType.SHA3,
});
(async () => {
try {
const wallet = fromRandom(type);
console.log(wallet.toJSON().type);
const res = await client.sendDeclareTx({
data: {
moniker: `wangshijun_${Math.round(Math.random() * 1000)}`,
pk: Buffer.from(hexToBytes(wallet.publicKey)),
type,
issuer: '',
data: null,
},
wallet,
});
console.log(res);
} catch (err) {
console.error(err);
}
})();
Reactions are currently unavailable