Update Alice & Bob addesses (sr25519, examples) (#810)

This commit is contained in:
Jaco Greeff
2019-03-29 10:40:38 +01:00
committed by GitHub
parent 502e53008b
commit a9ad4af9c8
25 changed files with 45 additions and 53 deletions
@@ -11,7 +11,7 @@
},
"dependencies": {
"@polkadot/api": "^0.45.14"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
@@ -3,7 +3,7 @@
const { ApiPromise } = require('@polkadot/api');
// Known account we want to use (available on dev chain, with funds)
const Alice = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ';
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB';
async function main () {
// Create an await for the API
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.45.14"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
@@ -3,7 +3,7 @@
const { ApiPromise } = require('@polkadot/api');
// Our address for Alice on the dev chain
const Alice = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ';
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB';
async function main () {
// Create our API with a default connection to the local node
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.45.14"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
@@ -2,23 +2,19 @@
// Import the API, Keyring and some utility functions
const { ApiPromise } = require('@polkadot/api');
const { Keyring } = require('@polkadot/keyring');
const { stringToU8a } = require('@polkadot/util');
// Important to note that we pad the seed to a length of 32 bytes using ' '
// The underlying seed needs to be exactly 32 bytes in length
const ALICE_SEED = 'Alice'.padEnd(32, ' ');
const BOB_ADDR = '5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE';
const BOB_ADDR = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM696e4';
async function main () {
// Create an instance of the keyring
const keyring = new Keyring();
// Add Alice to our keyring (with the known seed for the account)
const alice = keyring.addFromSeed(stringToU8a(ALICE_SEED));
// Instantiate the API
const api = await ApiPromise.create();
// Constuct the keying after the API (crypto has an async init)
const keyring = new Keyring({ type: 'sr25519' });
// Add alice to our keyring with a hard-deived path (empty phrase, so uses dev)
const alice = keyring.addFromUri('//Alice');
// Create a extrinsic, transferring 12345 units to Bob
const transfer = api.tx.balances.transfer(BOB_ADDR, 12345);
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.45.14"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.45.14"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
@@ -9,18 +9,18 @@ const testKeyring = require('@polkadot/keyring/testing');
const { randomAsU8a } = require('@polkadot/util-crypto');
// some constants we are using in this sample
const ALICE = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ';
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB';
const AMOUNT = 10000;
async function main () {
// create an instance of our testign keyring
// Create the API and wait until ready
const api = await ApiPromise.create();
// create an instance of our testing keyring
// If you're using ES6 module imports instead of require, just change this line to:
// const keyring = testKeyring();
const keyring = testKeyring.default();
// Create the API and wait until ready
const api = await ApiPromise.create();
// get the nonce for the admin key
const nonce = await api.query.system.accountNonce(ALICE);
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.45.14"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.45.14"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
@@ -11,8 +11,7 @@
},
"dependencies": {
"@polkadot/api": "^0.43.6",
"@polkadot/rpc-provider": "^0.43.6"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.43.6"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
@@ -3,7 +3,7 @@ const { ApiRx } = require('@polkadot/api');
const { pairwise, startWith } = require('rxjs/operators');
// Known account we want to use (available on dev chain, with funds)
const Alice = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ';
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB';
async function main () {
// Create an await for the API
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.43.6"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
+1 -1
View File
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.43.6"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
+1 -1
View File
@@ -5,7 +5,7 @@ const { combineLatest, of } = require('rxjs');
const { first, switchMap } = require('rxjs/operators');
// Our address for Alice on the dev chain
const Alice = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ';
const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB';
function main () {
// Create our API with a default connection to the local node
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.43.6"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
+8 -10
View File
@@ -1,21 +1,19 @@
// Import the API, Keyring and some utility functions
const { ApiPromise } = require('@polkadot/api');
const { ApiRx } = require('@polkadot/api');
const { Keyring } = require('@polkadot/keyring');
const { stringToU8a } = require('@polkadot/util');
const ALICE_SEED = 'Alice'.padEnd(32, ' ');
const BOB_ADDR = '5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE';
const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM696e4';
async function main () {
// Create an instance of the keyring
const keyring = new Keyring();
// Add Alice to our keyring (with the known seed for the account)
const alice = keyring.addFromSeed(stringToU8a(ALICE_SEED));
// Instantiate the API
const api = await ApiRx.create().toPromise();
// Create an instance of the keyring
const keyring = new Keyring({ type: 's25519' });
// Add Alice to our keyring (with the known seed for the account)
const alice = keyring.addFomUri('//Alice');
// Create a extrinsic, transferring 12345 units to Bob.
api.tx.balances
// create transfer
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.43.6"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.43.6"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
+4 -4
View File
@@ -8,18 +8,18 @@ const testKeyring = require('@polkadot/keyring/testing');
const { randomAsU8a } = require('@polkadot/util-crypto');
// some constants we are using in this sample
const ALICE = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ';
const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB';
const AMOUNT = 10000;
async function main () {
// Create our API with a connection to the node
const api = await ApiRx.create().toPromise();
// create an instance of our testign keyring
// If you're using ES6 module imports instead of require, just change this line to:
// const keyring = testKeyring();
const keyring = testKeyring.default();
// Create our API with a connection to the node
const api = await ApiRx.create().toPromise();
// find the actual keypair in the keyring
const alicePair = keyring.getPair(ALICE);
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.43.6"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"
+1 -2
View File
@@ -1,6 +1,5 @@
// Import the API & Provider and some utility functions
const { ApiRx } = require('@polkadot/api');
const { WsProvider } = require('@polkadot/rpc-provider');
const { ApiRx, WsPovider } = require('@polkadot/api');
// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
const testKeyring = require('@polkadot/keyring/testing');
const fs = require('fs');
@@ -10,7 +10,7 @@
"start": "node index.js"
},
"dependencies": {
"@polkadot/api": "^0.43.6"
"@polkadot/api": "^0.52.1"
},
"devDependencies": {
"rimraf": "^2.6.2"