Last active
April 2, 2021 09:55
-
-
Save nekomeowww/57faf84254995245cef35249185698ab to your computer and use it in GitHub Desktop.
Arweave Owner to Address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Arweave from 'arweave' | |
const arweave = Arweave.init({ | |
host: 'arweave.net', | |
port: 443, | |
protocol: 'https', | |
timeout: 20000, | |
logging: false | |
}) | |
/** | |
* Convert the value of owner field from Arweave transaction to Arweave Address | |
* @param {String} owner - owner field from Arweave transaction | |
* @returns - Arweave address | |
*/ | |
async function ownerToAddress(owner) { | |
const pubJwk = { | |
kty: 'RSA', | |
e: 'AQAB', | |
n: owner, | |
} | |
return await arweave.wallets.getAddress(pubJwk) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
中文注释的版本: