Giter Club home page Giter Club logo

docs's People

Contributors

0xbooler avatar 0xproflupin avatar adamdelphantom avatar bfriel avatar fragosti avatar frolovdev avatar gitbook-bot avatar jozanza avatar jusleg avatar justnom avatar nheingit avatar piotrjanosz avatar rawfalafel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docs's Issues

(iOS) Getting -32603 error from Universal link authorization

Hello, I'm trying to authorize a user wallet from my app to Phanton iOS using Universal links. I managed to launch the app and I can see the authorizartion request. Although when I accept it, I'm getting

?errorCode=-32603&errorMessage=Something+went+wrong.

and according to the official docs this is an internal issue. This is my test implementation so far:

private func requestWalletAuthorization() {
        guard let keypair = try? NaclBox.keyPair() else { return }
        let publicKey = keypair.publicKey.map { String(format: "%02hhx", $0) }.joined()
        
        Task {
            guard var urlComponents = URLComponents(
                string: "https://phantom.app/ul/v1/connect"
            ) else {
                return
            }
            urlComponents.queryItems = [
                URLQueryItem(
                    name: "app_url",
                    value: "https://website.com/"
                ),
                URLQueryItem(
                    name: "dapp_encryption_public_key",
                    value: publicKey
                ),
                URLQueryItem(
                    name: "redirect_link",
                    value: "https://website.com/"
                )
            ]
            
           // result: https://phantom.app/ul/v1/connect?app_url=https://website.com/&dapp_encryption_public_key=xxxxxxx&redirect_link=https://website.com/
            await UIApplication.shared.open(urlComponents.url!)
        }
    }

You guys have any clue on what I'm doing wrong? Thank you in advance.

Is it possible to sign a message (not a transaction)

With sol-wallet-adapter it is possible to sign a message as a proof of account ownership. This is useful for all sorts of things - a couple of projects used it for wallet verification for airdrops.

I don't see this documented anywhere for Phantom. Is this an existing feature? And if not, was it removed due to any specific reason?

solana object is not found on initial load (React)

Browser: Chrome 95.0.4638.54

Hi there!

I'm using Phantom Wallet extension in my React App. I am trying to check to see if the user has Phantom installed. If they don't send them a message saying to install it.

Currently I just check the window object directly on component mount like so:

if (window.solana) {
    // Do something with solana object
} else {
    // Tell user to download phantom wallet
}

A few things to note here:

  • I have tried checking for the phantom object which is also not there
  • If I hard refresh the page, the solana object is in the window object, but a quick refresh seems to not inject it again
  • I have added a 300ms timeout before checking for the solana object and it seems to work everytime!

Curious if you have come across this :)? Thanks!

Can't create new window.solana.Transaciton() through JS

I am trying to initiate a Solana transaction, using the wallet as a provider, however, it shows that the wallet itself does not have any of the constructors for creating SOL transactions, or any other constructed classes. Is this something I need to do with an external library?

Partilly Signed Transaction and signAndSendTransaction

Hi, since Phantom Labs discord doesn't give support anymore and I don'have have any reply from Phantom Support, I'll expose my issue here:

I'm creating a Transaction and then partially signed it, serialize it and send it to the frontend.

transaction.partialSign(bankKeypair)
const serializedTransaction = transaction.serialize({
    requireAllSignatures: false
})
serializedTransaction.toString('base64')

When I get the Transaction in the frontend, I recover it with:

const recoveredTransaction = Transaction.from(Buffer.from(serializedTransaction, 'base64'))

If I use the deprecated function from phantom wallet signTransaction

const signedTransaction = await window.solana.signTransaction(recoveredTransaction)
const result = await connection.sendRawTransaction(signedTransaction.serialize());

Everything works just fine!

If I use the correct method from phantom wallet signAndSendTransaction

const result = await window.solana.signAndSendTransaction(recoveredTransaction)

It fails with {code: -32003, message: 'Transaction creation failed.'}

Why does it fail with signAndSendTransaction and not with signTransaction and sendRawTransaction ?

Thank you,

Random issues appears since Tuesday

Hi!

Me and my team receives constant issues when reaching Phantom wallet through deep links. The wallet returns -32603 code with errors messages like "Missing sharing secret", "failed+to+send+transaction:+Transaction+simulation+failed:+Error+processing+Instruction+0:+incorrect+program+id+for+instruction", or "token not found"

Would be possible to check what happened in Phantom Wallet app since last update?

`signAndSendTransaction` Transaction recentBlockhash required error

import {
    Connection,
    LAMPORTS_PER_SOL,
    PublicKey,
    SystemProgram,
    Transaction,
    TransactionInstruction
} from "@solana/web3.js"

(async () => {

const tx = new Transaction();

const connection = await new Connection(
    network("http://localhost:8899"),'confirmed'
)

const {signature} = await window.solana.signAndSendTransaction(tx);
const b = await connection.confirmTransaction(signature);
console.log(b,123)

})()

Does not work and docs and very wrong https://docs.phantom.app/integrating/sending-a-transaction

Possible collection of user data

Interacts with on-chain program DeJBGdMFa1uynnnKiwrVioatTuHmNLpyFKnmB5kaFdzQ while it should just create a token account and transfer token there. Nothing more
image

Bug: Localhost subdomain (Eg: app.localhost:3000) doesnt mount Phantom onto window

I am trying to implement solana-labs/wallet-adapter in my latest next 13 project. I want to implement the wallet connection for my subdomain on localhost: app.localhost:3000, but the wallet adapter doesn't detect phantom wallet.
After some research i can confirm that the phantom wallet doesn't mount into the window object only when i use subdomain in localhost. it mounts normally when there is no subdomain.

Is there a fix for using subdomain in localhost development?

network and disconnect events not firing

I tried to revoke access from the extension but the disconnect event is not firing. Also, what event to watch for when user changes network from the extension?

Wallet adapter not firing event on wallet change

Phantom chrome extension: v23.19.0
Chrome (OSX) 120.0.6099.109 (Official Build) (arm64)

Hi, this was an issue that was resolved a couple of months back but seems to have crept back in recently.

When switching between Solana wallets on a connected dApp (using Solana wallet adapter), nothing happens and the old wallet stays connected.

Expected behaviour: the wallet change is picked up, so the user doesn't need to hard disconnect or refresh the page.

This is especially critical for our multi-sig locking feature in biblio.tech as users need to sign with 2 wallets, the app polls awaiting a wallet change which never fires.

Repro steps:

  • visit jup.ag
  • connect wallet
  • switch wallet in phantom extenstion
  • observe no change is picked up in the app.

Eagerly connecting from an untrusted client should return not throw

Right now his method:

window.solana.connect({ onlyIfTrusted: true });

throws a funky error that does not look to be by design:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '_bn')

It's tough to diagnose since Phantom does not seem to be open source (?), but that looks like the connect method itself is not catching an internal async error, rather than intentionally throwing a designed error. What would be even better than throwing a designed error though, is just returning a message code to the client without throwing at all.

As it stands, if the client attempts to eagerly connect but is not yet trusted, because of that uncaught async error within the connect method, the client cannot continue execution. So if, for example, you want to toggle a piece of client side state to indicate that an attempt was made to eagerly connect, you can't.

Calling connect({ onlyIfTrusted: true }) from an untrusted client is obviously an expected usage, so it should not result in an uncaught async error, or a designed thrown error, but simply a message code that indicates the client is not yet trusted. This would be much easier to handle from the client, and allow for better UX implementations.

Android(kotlin or Java) integration Guidence

I am bit confused to integrate SDK for android Kotlin. So, can anyone guide me for android Kotlin?

Actually, I am not femilier with react native and all the code and snippets are available in react native as per my knowledge.

So, I want to get any doc or resource for specific android kotln or java.

Open Browse Deeplink in In-App Browser on Initial Load

Hello ๐Ÿ‘‹

As this is the docs site, I'm not sure if this is the correct place for this issue, so let me know if there's a better one!

I'm following the browse documentation to deeplink users into the Phantom in-app browser.

Expected Behavior

  • users should be taken to the Phantom in-app browser on initial load of the Phantom app

Actual behavior

  • users are not taken to the Phantom in-app browser on initial load. users have to go back to the original app, click the button again, and then the Phantom in-app browser loads

Reproduction: https://codesandbox.io/s/jovial-pascal-8gymif?file=/src/App.js

Steps to reproduce:

  1. Make sure the Phantom app on your phone is killed
  2. Open https://8gymif.csb.app/ on a mobile browser
  3. Click "Connect with Phantom"
  4. Observe the Phantom app loading, but staying on the home screen and not opening the in-app browser
  5. Return to https://8gymif.csb.app/
  6. Click "Connect with Phantom"
  7. Now the Phantom in-app browser loads

Please let me know if I'm missing anything to make this work as expected, thanks!

Cannot execute transfer transaction

I was trying to transfer some funds from an address to another and the transaction never succeeds

Wallet A had 21884360103 LAMPORTS (=21.884360103 SOL, on Phantom I see 21.88436 SOL)
But if I try to transfer 21884310103 LAMPORTS (=21.884310103 SOL) to Wallet B

I get that it was unable to send the funds

It does that even with 21.88431 SOL (so it matches the precision that Phantom uses)

image

How signAndSendTransaction handle partial signed signature?

From my understand when we minting we have to partial sign tx with mint_keypair and call signAndSendTransaction.
But when I try call it with

    // Partial sign (except wallet)
    let recent_blockhash = client.get_latest_blockhash().await.unwrap();
    let signers: Vec<&dyn Signer> = vec![&mint_keypair];
    let _result = mint_tx.try_partial_sign(&signers, recent_blockhash);

    let message_data = transaction.message_data();
    let transaction_bs58 = encode(&message_data).into_string();
    let sign_json = json!({
        "method": "signAndSendTransaction",
        "params": {
            "message": transaction_bs58
        },
        "id": 1 as u32,
        "jsonrpc": "2.0"
    });
Phantom - RPC Error: Signature verification failed {code: -32003, message: 'Signature verification failed'}

When signTransaction working just fine for above tx.
So, How signAndSendTransaction handle partial signed signature there?

Thanks

Verify the signed message

Could you add the documentation for the signed message verification? I really appreciate it if you can mention which algorithm you're using to sign/verify the message. By default, I thought you guys are using nacl.sign as Solana Web3, but it seems not.

Phantom connection problem

Hey, I am using trying to connect phantom to my web app using the following function.

`
//@ts-ignore

    window.solana.connect();
     //@ts-ignore
    window.solana.on("connect", () => {
      setConnected(true);
      window.location.assign("#/dashboard")
    });

     //@ts-ignore
    window.solana.on("disconnect", () => {
      setConnected(false);
    });

    return () => {
      myWallet.disconnect();
    };
  }`

However, the connection is not established even though it was working before. Is there an update that occurred recently?

Add popular token

The account can't be used to receive the popular SPL token, because it did not send a transaction when added a popular token from the token list.
Any idea about this? It's different from other wallets.

[Deeplinks] Feature Request - ConnectAndSignAndTransfer method

Hello, any chance we could get a provider method
for connecting & signing & sending all in 1 go without having to get redirected back ? For use cases where there's just a simple transaction needed this seems like it could simplify UX. Or maybe an option to sign & send a transaction without having to first open a session through the connect method?

Error while scanning Solana Qr Code

When I try to scan a qr code in devnet the app crashes and solana pay qr code does not works.

solana:https%3A%2F%2Fsolana-pay-ruddy.vercel.app%2Fapi%3Frecipient%3DCSab2WuFWre1FAMAFpiTsyw4mZArrqTnsd3UYPqZgiiC%26amount%3D0.2%26label%3Dtest%26memo%3Dteste%26reference%3DAAuUEgyBcJWhDHUEvizSLLRUSSdgdfAYr58rpg9stJko

Steps to reproduce:
1 - scan qr code
qrcode

Connection Response from Phantom

No response from Phantom after connect

// Handle a `connect` response from Phantom
if (/onConnect/.test(url.pathname)) {
  const sharedSecretDapp = nacl.box.before(
    bs58.decode(params.get('phantom_encryption_public_key')!),
    dappKeyPair.secretKey,
  );
  const connectData = decryptPayload(
    params.get('data')!,
    params.get('nonce')!,
    sharedSecretDapp,
  );
  setSharedSecret(sharedSecretDapp);
  setSession(connectData.session);
  setPhantomWalletPublicKey(new PublicKey(connectData.public_key));
  console.log(`connected to ${connectData.public_key.toString()}`);
}

Feature Request Official Flutter SDK

Hey guys, any plans for making Flutter SDK? Would love to get Phantom support into our mobile app! We need you all! Did you know that even WalletConnect doesn't have an official Flutter SDK?

can`t signTransaction: too long waited to approve.

In the firefox browser, the transaction is rejected due to a long wait. When this is in the console, the reason is as follows: The user rejected the transaction. This problem is only in Firefox.

below code works for other wallets in google chrome

let transaction = new Transaction().add(
    new TransactionInstruction({
        data: createBidInstruction(chosenSideIndex, betValue),
        keys: [
            { pubkey: publicKey, isSigner: true, isWritable: true }, //from
            { pubkey: new PublicKey(bet.wallet), isSigner: false, isWritable: true }, //to
            { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }
        ],
        programId: new PublicKey('PROGRAMKEY')
    })
)
transaction.feePayer = transaction.feePayer || publicKey || undefined;
transaction.recentBlockhash = transaction.recentBlockhash || (await connection.getLatestBlockhash('finalized')).blockhash;

await sendTransaction(transaction, connection)

Cannot assign to read only property 'solana' of object '#<Window>'

Uncaught TypeError: Cannot assign to read only property 'solana' of object '#'
at Function.loadInjectObjectsOfSolana (chrome-extension://afbcbjpbpfadlkmhmclhkeeodmamcflc/inject_start.js:411)
at Pt.dispenseInjectMessage (chrome-extension://afbcbjpbpfadlkmhmclhkeeodmamcflc/inject_start.js:411)
at chrome-extension://afbcbjpbpfadlkmhmclhkeeodmamcflc/inject_start.js:411
at HTMLDocument. (chrome-extension://afbcbjpbpfadlkmhmclhkeeodmamcflc/inject_start.js:210)

The latest extension update may be causing some issues with solana injection. Any suggestion on fix?

connect method callback

Hi there,

Is there a way to know if user refuse to connect ?

	var provider = window.solana
	await ??? provider.connect({ onlyIfTrusted: false });

I tried this without success

	var result = await window.solana.request({
					method: "connect",
					params: {
						onlyIfTrusted: false 
					}
				})

other example:
image

my console.log or console.error never fire

Thanks for your help

PHANTOM DEBUG: Sent message to extension

I am receiving this log message from Phantom extension when visiting web3 apps (e.g. Uniswap).
Log messages are flooding browser console at a rate of 100/1 minute.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.