polkadotjs ライブラリを試すと、転送中にエラーが発生します。
これは私のコードです:
const { ApiPromise, WsProvider, Keyring } = require("@polkadot/api")
;(async () => {
const wsprovider = new WsProvider("ws://127.0.0.1:9944")
const api = await ApiPromise.create({
provider: wsprovider,
types: {
DepartmentDetails: {
name: "Text",
location: "Text",
details: "Text",
departmentid: "u128",
},
},
})
const keyring = new Keyring({ type: "sr25519" })
const alice = keyring.addFromUri("//Alice")
const BOB = keyring.addFromUri("//Bob")
try {
const txHash = await api.tx.balances.transfer(BOB, 12345).signAndSend(alice)
console.log(`Submitted with hash ${txHash}`)
} catch (err) {
console.log(err)
}
process.exit()
})()
エラーが発生します:
エラー: createType(Call):: Struct: failed on 'args':: Struct: failed on 'dest':: Decoding [object Object]: value.substr is not a function