Developer Questions
currency error
I have everything set up on WordPress and my wallet. The only error I'm getting now is, "please change store currency"
I found how to change the currency, but it's currently in Canadian dollars which I would still like to receive, but I would like to also receive XRP.
thanks
justin
Posted by justin rogers 9 months ago
Have hard time calling the XUMM api from my frontend
Goedemiddag :)
So first let me start with the error I am getting in my visual studio code
XUMM SDK: Running in browser
Error occurred while processing payment: TypeError: Network request failed
at <https://xumm.app/assets/cdn/xumm-sdk.min.js:15:38608> {stack: 'TypeError: Network request failed
at http…/xumm.app/assets/cdn/xumm-sdk.min.js:15:38608', message: 'Unexpected response from XUMM API [POST:payload]'}
Here is my HTML code:
```Text HTML
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<div class="container">
<nav>
<a href="index.html" class="brand">Core Values</a>
<ul class="menu">
<li><a href="#">Home</a></li>
<li><a href="#">Artworks</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Learn More</a></li>
<li><a href="#" class="btn btn-primary">Log in</a></li>
</ul>
<button class="menu-btn">
<i class="fas fa-bars"></i>
</button>
</nav>
<div class="header-body">
<div>
<p>
Through the veils of self-exploration, vulnerability becomes strength, and we evolve with cosmic grace.
</p>
<span class="bar"></span>
<h1>Buy NFTs</h1>
</div>
<div>
<h1>Sell NFTs</h1>
<span class="bar"></span>
<p>
Where shadows dance with enlightenment, we become alchemists of our destiny.
</p>
</div>
</div>
</div>
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/grid1-top.png" class="grid-img" alt="grid1-top">
</div>
</header>
<div class="container">
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/grid1-bottom.png" class="grid-img" alt="grid1-bottom">
<section class="services">
<div class="heading">
<h2>What We Actually Do?</h2>
<p>
NFTs are revolutionizing the world by enabling digital ownership, empowering creators to monetize
their work, transforming gaming and virtual real estate, and offering secure digital identity and
credentials. They also impact finance, charity, and real-world asset tokenization while revolutionizing
collectibles and intellectual property management. NFTs are reshaping industries and creating new
possibilities across various sectors. Through the veils of self-exploration, vulnerability becomes
strength, and we evolve with cosmic grace.
</p>
</div>
<div class="cards">
<div class="card">
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/wallet.png" alt="wallet">
<h3>Set up your wallet</h3>
</div>
<div class="card">
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/camera.png" alt="camera">
<h3>Create your own collection</h3>
<p>
NFT's are transforming the way commerce is transacted.
</p>
</div>
<div class="card">
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/gift.png" alt="gift">
<h3>Add your NFTs</h3>
<p>
NFTs are changing the world.
</p>
</div>
</div>
</section>
<section class="featured">
<div class="heading">
<h2>Featured Artworks</h2>
</div>
<div class="cards">
<div class="card">
<a href="#" onclick="handlePayment('Azul Colour Crystal', 20)">
<img class="art-img" src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/crystal1.jpg">
</a>
<div class="light"></div>
<h3 class="art-title">Azul Colour Crystal</h3>
<div class="favourites">
<div class="favourites">
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/user1.jpg" alt="artwork" />
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/user2.jpg" alt="artwork" />
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/user3.jpg" alt="artwork" />
<small>+2</small>
</div>
<div>
<span>Favourite This</span>
</div>
<div class="bid">
<div>
<p>Current Bid</p>
<h3>
<i class="fab fa-ripple"></i>
20XRP
</h3>
</div>
<div>
</div>
</div>
</div>
</div>
<div class="card">
<a href="#" onclick="handlePayment('Fire Balls', 100)">
<img class="art-img" src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/crystal2.jpg">
</a>
<div class="light"></div>
<h3 class="art-title">Fire Balls</h3>
<div class="favourites">
<div class="favourites">
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/user1.jpg" alt="artwork" />
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/user2.jpg" alt="artwork" />
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/user3.jpg" alt="artwork" />
<small>+2</small>
</div>
<div>
<span>Favourite This</span>
</div>
<div class="bid">
<div>
<p>Current Bid</p>
<h3>
<i class="fab fa-ripple"></i>
1000XRP
</h3>
</div>
<div>
</div>
</div>
</div>
</div>
<div class="card">
<a href="#" onclick="handlePayment('Emerald Colour Crystal', 20)">
<img class="art-img" src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/crystal3.jpg">
</a>
<div class="light"></div>
<h3 class="art-title">Emerald Colour Crystal</h3>
<div class="favourites">
<div class="favourites">
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/user1.jpg" alt="artwork" />
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/user2.jpg" alt="artwork" />
<img src="file:///C:/Users/mmmil/Pictures/Nieuwe%20map/img/user3.jpg" alt="artwork" />
<small>+2</small>
</div>
<div>
<span>Favourite This</span>
</div>
<div class="bid">
<div>
<p>Current Bid</p>
<h3>
<i class="fab fa-ripple"></i>
20XRP
</h3>
</div>
<div>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="explore">
<div class="grid">
<!-- Add grid items here -->
</div>
<h2>Explore our top artworks</h2>
<p>
"Step into a world of artistic wonders and discover our carefully curated selection of top artworks. From
captivating masterpieces to cutting-edge creations, prepare to be mesmerized by the beauty, depth, and
creativity on display. Unearth the essence of human expression and immerse yourself in a realm where art
knows no bounds. Unleash your imagination and embark on an unforgettable journey through the realms of
creativity."
</p>
</section>
<section class="trial">
<h2>Get a free trial</h2>
<p>"Unlock your path to personal growth with our NFT marketplace's free trial. Experience the transformative
power of exclusive NFTs, designed to inspire, empower, and elevate your journey towards self-discovery.
Embrace unique digital artworks and collectibles that hold profound meaning, connecting you to a community
of like-minded individuals striving for personal development. Don't miss this opportunity to explore the
future of art and personal growth, all at no cost with our limited-time free trial."</p>
<a href="#" class="btn-primary">Join Us Now</a>
</section>
<footer>
<div>
<h2>Digital Agency</h2>
<p>Our digital agency is driven and passionate about crafting exceptional digital solutions. With
creativity and innovation at the core, we strive to deliver remarkable experiences that elevate brands
and exceed expectations.</p>
<hr />
<h3>Get our latest updates</h3>
<form>
<div class="input-wrap">
<input type="email" placeholder="Please enter your email address">
<button type="submit" class="btn btn-primary">Send</button>
</div>
</form>
</div>
<div>
<h3>Company</h3>
<ul>
<li><a href="#about-us">About Us</a></li>
<li><a href="#our-team">Our Team</a></li>
<li><a href="#company-culture">Company Culture</a></li>
<li><a href="#partnerships">Partnerships</a></li>
<li><a href="#contact-us">Contact Us</a></li>
</ul>
<h3>Social Media</h3>
<ul>
<li><a href="#Facebook">Facebook</a></li>
<li><a href="#Twitter">Twitter</a></li>
<li><a href="#Telegram">Telegram</a></li>
<li><a href="#Instagram">Instagram</a></li>
<li><a href="#LinkedIn">LinkedIn</a></li>
</ul>
</div>
</footer>
</div>
<script src="https://xumm.app/assets/cdn/xumm-sdk.min.js"></script>
<script src="api.js"></script>
</body>
</html>
```
JavaScript Code:
```Text JavaScript
const { XummSdk } = require('xumm-sdk');
const Sdk = new XummSdk('370c6e43-d3ed-4bd7-b644-9177f14250ce', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX');
const handlePayment = async (artworkTitle, amount) => {
try {
const request = {
"TransactionType": "Payment",
"Destination": "rUjnffaez1ZqoH1CXS5G5tB4oiibhqczpf",
"Amount": amount.toString(),
"Memos": [
{
"Memo": {
"MemoData": artworkTitle
}
}
]
}
const subscription = await Sdk.payload.createAndSubscribe(request, event => {
console.log('New payload event:', event.data)
if (event.data.signed === true) {
// No need to console.log here, we'll do that below
return event.data
}
if (event.data.signed === false) {
// No need to console.log here, we'll do that below
return false
}
});
console.log(subscription.created);
const resolveData = await subscription.resolved;
if (resolveData.signed === false) {
console.log('The sign request was rejected');
}
if (resolveData.signed === true) {
console.log('The sign request was signed');
const result = await Sdk.payload.get(resolveData.payload_uuidv4);
console.log('User token:', result.application.issued_user_token);
alert(`Payment of ${amount}XRP for artwork "${artworkTitle}" is successful!`);
}
} catch (error) {
console.error('Error occurred while processing payment:', error);
alert('Payment process encountered an error. Please try again later.');
}
};
const main = async () => {
};
main();
```
And my Server-Side code I run on glitch:
```Text Server.js
const express = require('express');
const app = express();
const { XummSdk } = require('xumm-sdk');
const Sdk = new XummSdk('370c6e43-d3ed-4bd7-b644-9177f14250ce', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX');
const allowedOrigins = ['*', 'https://xumm.app'];
app.use((req, res, next) => {
const origin = req.headers.origin;
if (allowedOrigins.includes(origin)) {
res.setHeader('Access-Control-Allow-Origin', origin);
}
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
if (req.method === 'OPTIONS') {
return res.sendStatus(200);
}
next();
});
app.post('/handle-payment', async (req, res) => {
const artworkTitle = req.body.artworkTitle;
const amount = req.body.amount;
try {
res.json({ success: true, message: 'Payment initiated successfully.' });
} catch (error) {
console.error('Error occurred while processing payment:', error);
res.status(500).json({ success: false, message: 'Payment process encountered an error. Please try again later.' });
}
});
// Start the server
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`Server running on port ${port}`);
});
```
I am kind of stuck here and hoping you guys could help me out here , Am I missing something ?
Groeten uit Nederland :)
Posted by Maarten 9 months ago
Payload gets temMALFORMED response, but works fine in Payload Signing tool
<https://xumm.dev/signing-tool?payload=5576ce40-b97c-40f6-89d9-1c926ac3feec&txid=2253AD15E1BEBC005D9138AD1EBB847487E4B9D73A7506FFAD3148BF492353A3>
Above is an example of a successfully signed payload signed in the Payload Signing Tool.
This same payload gets a `temMALFORMED` error when I attempt to sign it via the jwt API from my app. The only difference is the addition of the redirect_url:
```json
{
"options": {
"return_url": {
"app": 'origami://?id={id}&cid={cid}&txid={txid}&txblob={txblob}',
"web": 'origami://?id={id}&cid={cid}&txid={txid}&txblob={txblob}',
},
},
"txjson": {
"Account": "rhJ6HKU4rLXGEkKHXLRoL7B61XvLz9JCem",
"Amount": "1000000",
"CancelAfter": 743736082,
"Destination": "rhJ6HKU4rLXGEkKHXLRoL7B61XvLz9JCem",
"Flags": 0,
"LedgerEntryType": "Escrow",
"TransactionType": "EscrowCreate"
}
}
```
Any ideas of what might be going on, or how to troubleshoot this? I am using the testate, but the signing tool doesn't seem to mind.
Posted by Origami 9 months ago
Possible to authorize in React Native using xumm universal SDK?
Here's the setup I'm currently trying:
```typescript
// from expo-auth-session
const [request, response, promptAsync] = useAuthRequest(
{
clientId: process.env.EXPO_PUBLIC_XUMM_API_KEY,
redirectUri: 'origami://',
},
{
authorizationEndpoint: 'https://oauth2.xumm.app/auth',
},
);
```
This works! It opens up the xumm app and allows me to fulfill the signing request. The response then returns an `authorization_code`, `code`, and `state`. I think this is the point where I'm going wrong...
I re-initialize the xumm SDK, i.e.
```typescript TypeScript
XummSdk = new Xumm(authorization_code);
const pong = await XummSdk.ping();
console.log({ pong }); // pong is undefined :(
```
Unfortunately, it doesn't seem to be authenticated, so I expect there's some extra magic that needs to happen to properly initialize Xumm. I have console warnings telling me that properties are missing (i.e. `payload`), and various environment properties are undefined as well, implying to me that it's not authenticated.
What am I missing? Thanks!
Posted by Origami 9 months ago
How to check auth status with universal Xumm SDK?
I'm creating an auth flow using the Xumm universal SDK in Web3/Browser mode (PKCE). How do I check if the user is authorized?
- XummSDK.user always contains a value
- XummSDK.ping() doesn't return a resolved value as the docs say it does
- I found an example calling XummSDK.state(), but that doesn't seem to exist
- I see useful looking functions and properties under XummSDK.environment, but don't know which to use
It would be helpful to have something like XummSDK.isAuthoirized (boolean)
Recommendation? Thanks!
Julian
Posted by Origami 9 months ago
QR API not working: Cannot construct STArray from value given
Hello, I was getting custom qr-code (code shared below) depending upon the amount and avax_address but now I am getting the following errors:
**library version: **"xumm-sdk": "^1.8.4"
**Internal error code:** 603
**Error (detail) message Error:** Payload encoding error: Cannot construct STArray from value given
**Causing error message:** Cannot construct STArray from value given
```Text ts
BURN_ADDRESS = 'rhJYDuVMQxabTyiWuHQkQyDxr6uZEdpv5u'
export const getQR = async (avax_address: string, amount: string) => {
try {
const hex_avax_address = Buffer.from(avax_address)
.toString("hex")
.toUpperCase();
const request = {
TransactionType: "Payment",
Destination: BURN_ADDRESS,
Amount: {
currency: 'MLD',
value: amount,
issuer: BURN_ADDRESS,
},
Memos: [
{
Memo: {
MemoData: hex_avax_address,
},
},
],
};
const payload = await Sdk.payload.create(request, true);
return {
link: payload?.next?.always,
qr_code: payload?.refs?.qr_png,
};
} catch (error) {
console.log(error);
return null;
}
};
```
Posted by MLD Migration (XRP - AVAX) 9 months ago
xApp not loading
I'm working on a simple xapp but I'm unable to load it in my device (in xumm). It works well when I load it in the browser. I am using this (<https://github.com/XRPL-Labs/XummSDK-React-Demo>) github repo for reference.
xApp api key: 3fa32a38-2792-441d-a4d7-d6dcc6c8e6ce
Posted by Aditya D. 10 months ago
Cached xumm's CDN of NFT Image URL which has "#" in image name is unhandled
Specific NFT:
<https://bithomp.com/hr/nft/00081702450BA01D0D00DAD5DB980301D6D18C7E1BCAED3E18938AC1000001ED>
You can see image does not show in Xumm.
Posted by NFT Burn 10 months ago
Bypass the Black Hole Account destination
Hello,
Hope you are doing good. I have a question, How can I bypass the black hole account burn navigate back screen in the Xumm wallet app? is there a way to do that? Can I turn off that security check?
Thanks.
Posted by MLD Migration (XRP - AVAX) 10 months ago
Payment request feature inquiry
I have a question regarding the payment request feature associated with the provided link.
**This is a testnet account**
<https://xumm.app/detect/request:rhd27qnmywZhcsDq5q2K2QZaUGmvYMFRdT?amount=10>
I noticed that the link generates a QR code to request a payment of 10 XRP. I am curious to know if it is possible to utilize the payment request feature for requesting tokens instead of XRP. Specifically, I am interested in exploring the feasibility of requesting a payment in tokens using the same mechanism.
If such functionality exists or there are alternative methods to request token payments through the platform, I would greatly appreciate any guidance or information you can provide.
Posted by MLD Migration (XRP - AVAX) 11 months ago