XRPのアクティベートまとめ
- XRPアドレスはリザーブ(20XRP)を持っていない場合は送受信ができない。
- ならば、そのXRPアドレスにとりあえず初回の20XRPを送ればアクティベートできる。と思っていたがprepareTransaction()を使った送金方法ではアクティベートができなかった。
- account not foundのエラーになってしまう。
- ただしくはpreparePayment()を使ってアクティベートする必要があった。
# "アカウント作成"というトランザクションは無い。
There is not a dedicated "create account" transaction.
# ペイメントトランザクションは自動的に新アカウントを作るよ。まだアカウントがない有効なアドレスにリザーブ(20XRP)以上を送ればね。
The Payment transaction automatically creates a new account if the payment sends XRP equal to or greater than the account reserve to a mathematically-valid address that does not already have an account.
# 他のトランザクションではアカウントは作れない。
No other transaction can create an account.
ソース
function preparePayment(
this: RippleAPI,
address: string,
payment: Payment,
instructions: Instructions = {}
): Promise<Prepare> {
try {
validate.preparePayment({address, payment, instructions})
const txJSON = createPaymentTransaction(address, payment)
return utils.prepareTransaction(txJSON, this, instructions)
} catch (e) {
return Promise.reject(e)
}
}
- preparePayment()でアクティベートするサンプルコード
api.connect().then(() => {
console.log('Connected...')
api.preparePayment(senderAddress, payment, instructions).then(prepared => {
const {signedTransaction, id} = api.sign(prepared.txJSON, senderSecret)
console.log('Submitting payment...')
console.log(id)
api.submit(signedTransaction).then(result => {
console.log(JSON.stringify(result, null, 2))
api.disconnect()
})
})
}).catch(console.error)
- XRPアドレスのアクティベートはKYC/AMLの関係で取引所に送らないといけないのか?と思っていたけど全然違ったしドキュメントに書いてあったよ。という話でした。
- 反応があればもうちょっと書く。