Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 325
1 vote

How do i convert a unix timestamp to a UTC date string on chain?

Although I believe the advice you got in the comments is correct and you shouldn't convert to UTC unless to display in the UI, I hate answers that just say "Why would you do that?" instead of answerin …
McBain's user avatar
  • 5,384
1 vote
Accepted

Using `onAccountChange` in Rust

Figured it out: let listener_client = PubsubClient::new(<WSS URL>).await.unwrap(); // Can add a config instead of None here, but None for simplicity let (stream, shutdown_handle) = listener_client.acc …
McBain's user avatar
  • 5,384
1 vote
Accepted

Request solana airdrop in rust/anchor

Nevermind, figured it out: /// Replace with devnet or whichever cluster you're currently on let rpc = RpcClient::new(Cluster::Localnet.url()); let sig = rpc.request_airdrop(pubkey, lamports).unwrap(); …
McBain's user avatar
  • 5,384
1 vote

Can anyone use SolGSN: Solana Gas Station?

Yes, there is a few ways to do this. One is using Octane which is a gasless relayer developed by Solana Labs. Another is coding this together yourself. Each transaction has a feepayer field, so if you …
McBain's user avatar
  • 5,384
3 votes

How to submit a transaction on ui side?

You can see you got the custom error 0xbbf, or in decimal, 3007. Since this was not defined by you, it must have come from Anchor itself. You can find a reference of the meaning behind all Anchor erro …
McBain's user avatar
  • 5,384
3 votes
Accepted

Handle big vector containing ton of structs

I'm guessing you're trying to initiate your account with size ::INIT_SPACE in your transaction. This won't work because the maximum amount of bytes you can (re)alloc in one transaction is 10240 bytes. …
McBain's user avatar
  • 5,384
3 votes

How can we prevent wallet to not hold more than 1% token if market cap is under 1B

You can use transfer hooks for this. The below transfer hook in anchor ensures that no address ever has more than 1000 tokens for example. The key parts to this are the MAX_AMOUNT constant and the tra …
McBain's user avatar
  • 5,384