import { Xumm } from "xumm"
const Sdk = new Xumm(process.env.XUMM_KEY, process.env.XUMM_SECRET)
const pong = await Sdk?.ping()
const payload = await Sdk.payload?.create({
custom_meta: {
instruction: "Sign request from " + pong?.application.name,
},
txjson: {
TransactionType: "SignIn",
},
})
console.log(payload)
See this code in action:
const { Xumm } = require("xumm")
const Sdk = new Xumm(process.env.XUMM_KEY, process.env.XUMM_SECRET)
Sdk.ping().then(pong => {
Sdk.payload.create({
custom_meta: {
instruction: "Sign request from " + pong.application.name,
},
txjson: {
TransactionType: "SignIn",
}
}).then(payload => {
// Done
console.log(payload)
})
})
const Sdk = new Xumm('some-api-key')
Sdk.authorize()
Sdk.on("ready", () => {
Sdk.ping().then(pong => {
Sdk.payload.create({
custom_meta: {
instruction: "Sign request from " + pong.application.name,
},
txjson: {
TransactionType: "SignIn",
}
}).then(payload => {
// Done
console.log(payload)
})
})
})