-
Notifications
You must be signed in to change notification settings - Fork 0
/
03_TransferObjects.ts
27 lines (18 loc) · 943 Bytes
/
03_TransferObjects.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
import {Ed25519Keypair, JsonRpcProvider, Connection} from '@mysten/sui.js';
import {getFullnodeUrl} from "@mysten/sui.js/client";
// Generate a new Ed25519 Keypair
const keypair = new Ed25519Keypair();
const connOptions = new Connection({
fullnode: getFullnodeUrl("testnet"),
});
let provider = new JsonRpcProvider(connOptions);
const addr = keypair.getPublicKey().toSuiAddress();
console.log("Requesting sui tokens for address: " + addr);
provider.requestSuiFromFaucet('0x6cd789e6e45489fc61959e0aaa57e573f76c57d05c3c376684f6810e899ecc37')
.then(function(result){
console.log("Request finished with result: "+ result);
})
console.log(" public key base 64 ", keypair.getPublicKey().toBase64());
console.log(" public key toString ", keypair.getPublicKey().toString());
console.log(" public key to Sui Address ", keypair.getPublicKey().toSuiAddress());
console.log("Exported keypair", keypair.export());