Comments (4)
Adding on to my example code:
async function main() {
PAYLOAD_CID = 'bafkqac33ejqseorcmfzwiit5'
WALLET_ADDRESS = '0xb1DAB7708d6E3dE3006861b68dE3c1a4055DbAaB'
// find deal_id
const uploadInfo = await client.listUploads(PAYLOAD_CID, PAYLOAD_CID)
const dealId = uploadInfo.data.deal_id
const fileDetails = await client.getFileDetails(PAYLOAD_CID, dealId)
console.log(fileDetails.data.deal.ipfs_url)
const nft = {
name: 'My NFT Name',
image: fileDetails.data.deal.ipfs_url,
}
const mintTx = await client.mintAsset(PAYLOAD_CID, nft)
console.log(mintTx)
}
from js-mcs-sdk.
Usually, the user will find the ipfs_url
returned from client.upload()
to find the ipfs_url
later, it is found by client.getFileDetails(payload_cid, deal_id)
to find the deal_id
... the user can search the deal list client.listUploads(wallet_address, payload_cid)
(can also use client.publicKey to get wallet_address
ex.
async function main() {
PAYLOAD_CID = 'bafk2bzaceddm5zocmawl4jrstyi3cfzdmqok7mhaac44gvv7w5oxtzyp2ztse'
WALLET_ADDRESS = '0xb1DAB7708d6E3dE3006861b68dE3c1a4055DbAaB'
// find deal_id
const uploadInfo = await client.listUploads(PAYLOAD_CID, PAYLOAD_CID)
const dealId = uploadInfo.data.deal_id
const fileDetails = await client.getFileDetails(PAYLOAD_CID, dealId)
console.log(fileDetails.data.deal.ipfs_url)
// https://calibration-ipfs.filswan.com/ipfs/QmP5haQgHZ2sbWTGmArCq6qy1y5ifBWqkvHhBfS6A19i46
}
from js-mcs-sdk.
`c
onst nft = {
name: 'File 1', // the name of your NFT
description: 'This is the first file', // the description of your NFT
image: uploadResponses[0].data.ipfs_url, // asset URI, images will render on Opensea
tx_hash: '0x...', // payment tx_hash, will be inserted automatically
}
const mintTx = await client.mintAsset(payloadCid, nft)
console.log(mintTx)
`
如果我有个文件只上传没有铸造,后来我再想铸造改如何获取ipfs_url
from js-mcs-sdk.
谢谢~我试下
from js-mcs-sdk.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-mcs-sdk.