8 |
9 |
--------------------------------------------------------------------------------
/custom.css:
--------------------------------------------------------------------------------
1 | /* Custom page CSS
2 | -------------------------------------------------- */
3 | /* Not required for template or sticky footer method. */
4 |
5 | .container {
6 | width: auto;
7 | padding: 15px;
8 | }
9 |
10 | .footer {
11 | background-color: #f5f5f5;
12 | }
13 |
14 | pre {
15 | white-space: pre-wrap; /* Since CSS 2.1 */
16 | white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
17 | white-space: -pre-wrap; /* Opera 4-6 */
18 | white-space: -o-pre-wrap; /* Opera 7 */
19 | word-wrap: break-word; /* Internet Explorer 5.5+ */
20 | }
21 |
22 | h4 {
23 | padding-top: 20px;
24 | }
--------------------------------------------------------------------------------
/balance-transfer/balance-transfer.js:
--------------------------------------------------------------------------------
1 | const BOB = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty";
2 |
3 | function AliceKey() {
4 | const k = new keyring.Keyring({ type: "sr25519" });
5 |
6 | }
7 |
8 | async function transfer() {
9 | // Instantiate the API
10 | const api = await ApiPromise.create();
11 |
12 | // Constuct the keying after the API (crypto has an async init)
13 | const keyring = new keyring.Keyring({ type: "sr25519" });
14 |
15 | // Add alice to our keyring with a hard-deived path (empty phrase, so uses dev)
16 | const alice = keyring.addFromUri("//Alice");
17 |
18 | // Create a extrinsic, transferring 12345 units to Bob
19 | const transfer = api.tx.balances.transfer(BOB, 12345);
20 |
21 | // Sign and send the transaction using our account
22 | const hash = await transfer.signAndSend(alice);
23 |
24 | console.log("Transfer sent with hash", hash.toHex());
25 | }
26 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Shawn Tabrizi
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/balance-transfer/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Substrate RPC Examples
10 |
11 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |