Browse Source

api-examples: some code cleanup

Mokhtar Naamani 4 years ago
parent
commit
ba05fb59c8
2 changed files with 2 additions and 6 deletions
  1. 1 4
      api-examples/scripts/transfer.js
  2. 1 2
      api-examples/src/script.ts

+ 1 - 4
api-examples/scripts/transfer.js

@@ -8,7 +8,7 @@
 //
 // requires nicaea release+
 
-const script = async ({ api, keyring, types, joy }) => {
+const script = async ({ api, keyring }) => {
   const sudoAddress = (await api.query.sudo.key()).toString()
   let sudo
   if (typeof window === 'undefined') {
@@ -19,10 +19,7 @@ const script = async ({ api, keyring, types, joy }) => {
     sudo = sudoAddress
   }
 
-  const nonce = (await api.query.system.account(sudoAddress)).nonce
-
   const transfer = api.tx.balances.transfer(sudoAddress, 100)
-  console.log(transfer)
   await transfer.signAndSend(sudo)
 }
 

+ 1 - 2
api-examples/src/script.ts

@@ -3,8 +3,7 @@
 import { ApiPromise, WsProvider } from '@polkadot/api'
 import * as types from '@polkadot/types'
 import * as util from '@polkadot/util'
-import { types as joyTypes } from '@joystream/types'
-import * as joy from '@joystream/types'
+import joy, { types as joyTypes } from '@joystream/types'
 import * as hashing from '@polkadot/util-crypto'
 import { Keyring } from '@polkadot/keyring'