Threads
December 23rd, 2021
We have currently 9 threads for the above date.
š ā dev-support
status - Resolved
locdt --> hi! how I can catch the result of 1 Promise cross-contract call.
Benji | NEAR --> use .then
š ā dev-support
status - Unresolved
yuxuan --> i use command ./target/release/neard --home ~/data/ run to run a testnet node ,but it console this log for a long time ,I donāt know if this state is correct
yuxuan -->
Benji | NEAR --> itās still downloading the state - wait until the morning and see if it finishes
yuxuan --> This state has been running for hours
š ā dev-support
status - Resolved
ttnguyen --> Hi is there any RPC call to get NFT of a users?
Benji | NEAR --> no there is not
ttnguyen --> So how can we show the NFT of users
ttnguyen --> like collection section in the NEAR wallet
Benji | NEAR --> you need to keep track of that information yourself
Benji | NEAR --> the wallet uses the event standard to populate a database anytime an NFT is minted or transferred and it keeps track of all that information so that it can show the NFTs.
ttnguyen --> Oh it really hard for user
Benji | NEAR --> yea I mean at that point, do you really need to view all the NFTs that any user owns across all contracts?
Benji | NEAR --> if the answer is yes, then you gotta do some work to index that data š
Benji | NEAR --> you can easily view all the NFTs owned by a user on a single smart contract though
ttnguyen --> Yes, 1 smart contract is very easy stuff. So may be I will ask user input their nft contrat id, and nft id, so that I can get metadata and display on my site. Is it make sense?
Benji | NEAR --> it all depends on what youād like to accomplish. The power to know exactly what NFTs are owned by any user across all smart contracts is not a trivial solution. It will require indexers, databases and a good amount of work on your end.
Perhaps an alternative to what you suggested (which could be a nicer UX) is to have the user input smart contracts which are remembered in local storage. It will then display all the NFTs that the user owns for each smart contract that theyāve inputted. They can then click on whatever NFT they want for any of the contracts theyāve inputted. You can make the contracts collapsable etcā¦
Benji | NEAR --> the sky is your limit my friend š
Benji | NEAR --> but that is a much less expensive and time consuming solution to your problem IMO
ttnguyen --> yes, thank you, I will ask my boss =))) šµāš«
Benji | NEAR --> go team š
ttnguyen --> https://tenor.com/view/crazy-alert-crazy-alert-alerta-alerta-loca-gif-15115104
Alex_Goodv1n_WTV --> Hey, buddy
I just joined NEAR but, I can help you with showing NFTs
I started working on my project where I need a gallery, so the process has two steps:
GET https://helper.mainnet.near.org/account/${accountId}/likelyNFTs
- this will return the array of contracts where this account has NFTs
Use view function nft_tokens_for_owner
for each nft contract to get all NFTs
š ā dev-support
status - Resolved
confusion summary: User is looking for an approach or best practice for leveraging storage on their dApp
resolution summary: Every dApp is different, and as of yet there is no best practice except to say that non-transactional data doesn't need to be on the blockchain and can use other options like IPFS or centralized solutions despite that being considered antagonistic towards decentralization.
fatwontonboy --> Anyone have experience building dapps? I canāt figure out what to do with storage. In traditional app, you would use MySql or MongoDB to store data. You can perform analysis, index, queryā¦etc With Blockchain⦠must store data off-chain. But IPFS and Arweave are just generic file storage for stuff like .png or videos. I guess you could store Json too. What is a ābest practiceā and āscalableā way to do this the decentralized way for storage? Was reading this post, but no good answers. https://ethereum.stackexchange.com/questions/25335/dapp-storage-for-data-other-than-tranactions
Benji | NEAR --> I donāt think there is a best practice. Most dApps have their own centralized databases that are extensions of the blockchain. You can store assets on IPFS and Arweave as you mentioned and then have the blockchain and also your own DB.
fatwontonboy --> dang⦠but that is not decentralized some would cry
Benji | NEAR --> itās completely up to the dApp. You could in theory store EVERYTHING on chain, it would just be expensive š
Benji | NEAR --> In most cases, dApps will store the fluff and extra information that isnāt worth putting on chain in their databases.
fatwontonboy --> yes sir super expensive. Hence I am scratching my head, as this must be a common big problem
fatwontonboy --> But now where is the db? who host the db? ends up being the big question. I wonder how major dapps do it
fatwontonboy --> technically that is a huge single point of failure š¦
Benji | NEAR --> Māy company uses Postgres and cosmos DB
Benji | NEAR --> If our databases go down, the functionality of our application wonāt break.
Benji | NEAR --> users can still purchase NFTs with the expected outcome etcā¦
fatwontonboy --> So its just non-transactional data that dont need to be on blockchain?
Benji | NEAR --> yes
Benji | NEAR --> Just information that is easier to perform queries on and allows us to populate pages / data on the site more easily.
fatwontonboy --> In this example here https://ethereum.stackexchange.com/questions/25335/dapp-storage-for-data-other-than-tranactions, the author wants to make a decentralized Yelp. The data for restaurants & reviews are vital and need to be stored decentralized way (what is yelp without the reviews?).
fatwontonboy --> How would one go about doing this? CAnāt use centralized database. Author proposed to use smart contracts as ātablesā and store hash to IPFSā¦
fatwontonboy --> sounds hacky, wondering if thereās better more scalable way
Benji | NEAR --> honestly, not sure - at that point, Iād store everything on-chain in smart contracts. cc <@!bucanero> you did a bunch of work with decentralized storage solutions - do you have any input on this conversation?
fatwontonboy --> <@!Benji | NEAR> you the man by the way, thanks for the info!
Aaron | Vital Point AI --> Recommend taking a look at Ceramic Network - https://ceramic.network We use them to manage profiles and community information including comments and things that resemble reviews. Those artifacts then become available as data streams outside of your app as well.
š ā dev-support
status - Resolved
KennyYeg --> Hi! when trying to link a wallet for payment getting this error - is it coming from NEARs end?
Please try again in 30 seconds.
9:46 BadGatewayError:Please try again in 30 seconds.
KennyYeg --> also getting this a lot ForbiddenError: You must provide a blockNumber within 100 of the most recent block; provided: 55823210, current: 55823209
Benji | NEAR --> testnet seems to be working fine on my end. Not sure, maybe try again later?
KennyYeg --> Are there issues transferring $ from wallet right now?
KennyYeg --> test net is fine its the main net
Benji | NEAR --> oop yea youāre right let me see if itās being worked on yet
Benji | NEAR --> team is working on it.
š ā dev-support
status - Unresolved
Dima Gomaa --> <@!khorolets> we are really stuck š¦
after the node upgraded to 1.23 and db migration completed
it is giving
Dec 23 13:51:47.571 ERROR client: Error processing sync blocks: Invalid Signature
Cause: Unknown
Dec 23 13:51:47.571 WARN client: Banning node for sending invalid block headers
Dec 23 13:51:47.571 WARN network: Banning peer Some(ed25519:25fSg2aqemEryuKBBByM3GDtCMZSyaQ7ZzfkJSPghx2Y@95.216.9.170:24567) for BadBlockHeader
Dec 23 13:51:47.571 WARN network: Banning peer ed25519:25fSg2aqemEryuKBBByM3GDtCMZSyaQ7ZzfkJSPghx2Y for BadBlockHeader
Dec 23 13:51:47.644 WARN client: Sync: no peers available, disabling sync
Dec 23 13:51:51.918 INFO stats: #55439471 PX3HWHJQSYSXkMsHBSMdZS5epbrxV9PmzRKdNo8PoRg -/59 0/0/40 peers ⬠0 B/s ⬠0 B/s 0.00 bps 0 gas/s CPU: 84%, Mem: 371.9 MiB
Dec 23 13:51:57.644 WARN client: Sync: no peers available, disabling sync
Dec 23 13:52:01.936 INFO stats: #55439471 PX3HWHJQSYSXkMsHBSMdZS5epbrxV9PmzRKdNo8PoRg -/59 0/0/40 peers ⬠0 B/s ⬠0 B/s 0.00 bps 0 gas/s CPU: 89%, Mem: 463.7 MiB
Dec 23 13:52:07.646 WARN client: Sync: no peers available, disabling sync
Dec 23 13:52:11.940 INFO stats: #55439471 PX3HWHJQSYSXkMsHBSMdZS5epbrxV9PmzRKdNo8PoRg -/59 0/0/40 peers ⬠0 B/s ⬠0 B/s 0.00 bps 0 gas/s CPU: 76%, Mem: 298.2 MiB
Dec 23 13:52:17.646 WARN client: Sync: no peers available, disabling sync
Dima Gomaa --> and not moving forward, how can we get our nodes running again
khorolets --> <@!Bowen> can you have a look please?
š ā dev-support
status - Resolved
Alex_Goodv1n --> just joined NEAR space
Alex_Goodv1n --> on the last week
sormagec --> understood i experienced rust 5 year later, last time i wrote rust, i built a firmware for raspberry pi camera module š
sormagec --> and now writing a contract for nft
sormagec --> really life is interesting
Alex_Goodv1n --> It seems to me that the current examples are not quite suitable for collections.
Alex_Goodv1n --> So, I will change it a bit and open the code
Benji | NEAR --> have you taken a look at this: https://docs.near.org/docs/tutorials/contracts/nfts/introduction
Alex_Goodv1n --> sure
Benji | NEAR --> this will sort out all your NFT needs š
sormagec --> thank you bro
Alex_Goodv1n --> but collection sale has a bit different logic
sormagec --> yeah <@!Alex_Goodv1n> different than other chains
Alex_Goodv1n --> but it covers 90% of work
Benji | NEAR --> if youāre coming from ETH, I would still recommend going through that tutorial as it will help you familiarize yourself with the standards.
Benji | NEAR --> We just released a marketplace tutorial for that series yesterday night
Benji | NEAR --> https://docs.near.org/docs/tutorials/contracts/nfts/marketplace
Benji | NEAR --> Feel free to build off of it and tailor it to meet your specific needs.
Alex_Goodv1n --> great thanks! I will use it š
š ā dev-support
status - Resolved
confusion summary: User needed help logging with `log`
resolution summary: Ultimately the user used `stdout: println!` which worked. Make sure you are importing "log" correctly when applicable.
bosnic --> Iām trying to add logs with log!
to ft_on_transfer
(implementing near contract standards) to debug a unit test, but no logs from that function show up when I run tests with RUST_BACKTRACE=1 cargo test -- --nocapture
. I can verify that execution has reached that point by putting an assert after the log that fails
Cap 'n Dori Jones | NEAR --> So you tried importing log from the near-sdk-rs and it didnāt return anything?
bosnic --> yes, imported it from near-sdk and do not get any output when calling ft_on_transfer
, even with --nocapture
. This issue doesnāt occur when calling a function that doesnāt return a Promise
bosnic --> Is there anything different I need to do when logging from a function that returns PromiseOrValue
?
Cap 'n Dori Jones | NEAR --> are you working off a contract template or writing your own from the standard?
Cap 'n Dori Jones | NEAR --> maybe you have to put the log in the function that captures the result of the promise?
bosnic --> ah was just looking at stdout: println! works - does log! go to stdout in a unit test?
Cap 'n Dori Jones | NEAR --> mmm not sure honestly.
But println! works for you?
bosnic --> yep
Cap 'n Dori Jones | NEAR --> Iām curious as to why log! didnāt work with promises
Cap 'n Dori Jones | NEAR --> but Iām glad you found an alternative!
š ā dev-support
status - Unresolved
bosnic --> Another question: when I try to deserialize a message in ft_on_transfer
with serde_json (serde_json::from_str::<Instruction>(&msg)
), I get this error:
Error("u128 is not supported", line: 0, column: 0)'
The msg: msg: {"type":"Buy","market_id":0,"outcome_id":0,"num_shares":5}
I donāt use u128 for any of the fields
bosnic --> ```
#[derive(Serialize, Deserialize)]
#[serde(crate = ānear_sdk::serdeā)]
#[serde(tag = ātypeā)]
pub enum Instruction {
Buy(Buy),
InitialDeposit(InitialDeposit),
}
#[derive(Serialize, Deserialize)]
#[serde(crate = ānear_sdk::serdeā)]
pub struct Buy {
pub market_id: u64,
pub outcome_id: u32,
pub num_shares: Balance,
}
#[derive(Serialize, Deserialize)]
#[serde(crate = ānear_sdk::serdeā)]
pub struct Sell {
pub market_id: u64,
pub outcome_id: u32,
pub num_shares: Balance,
}
#[derive(Serialize, Deserialize)]
#[serde(crate = ānear_sdk::serdeā)]
pub struct InitialDeposit {
pub market_id: u64,
}
Benji | NEAR --> what is `Instruction`
Cap 'n Dori Jones | NEAR --> Sorry, but what's this line doing?
` Buy(Buy),`
Benji | NEAR --> that's an enum
Benji | NEAR --> They're saying that `Buy` is of type `Buy`
Cap 'n Dori Jones | NEAR --> where Buy is a struct here?