Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update URLs to point specifically to v1 of the @solana/web3.js docs #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion development-powertools/solana-versioned-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d \

```

You can also do the same using the [`@solana/web3.js`](https://solana-labs.github.io/solana-web3.js/) library.
You can also do the same using the [`@solana/web3.js`](https://solana-labs.github.io/solana-web3.js/v1.x/) library.

```javascript
// connect to the `devnet` cluster and get the current `slot`
Expand Down
4 changes: 2 additions & 2 deletions getting-started-with-solana/establishing-a-connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ useEffect(() => {

## Changing Accounts

Phantom allows users to seamlessly manage multiple accounts (i.e. [Keypairs](https://solana-labs.github.io/solana-web3.js/classes/Keypair.html)) from within a single extension or mobile app. Whenever a user switches accounts, Phantom will emit an `accountChanged` event.
Phantom allows users to seamlessly manage multiple accounts (i.e. [Keypairs](https://solana-labs.github.io/solana-web3.js/v1.x/classes/Keypair.html)) from within a single extension or mobile app. Whenever a user switches accounts, Phantom will emit an `accountChanged` event.

If a user changes accounts while already connected to an application, and the new account had already whitelisted that application, then the user will stay connected and Phantom will pass the [PublicKey](https://solana-labs.github.io/solana-web3.js/classes/PublicKey.html) of the new account:
If a user changes accounts while already connected to an application, and the new account had already whitelisted that application, then the user will stay connected and Phantom will pass the [PublicKey](https://solana-labs.github.io/solana-web3.js/v1.x/classes/PublicKey.html) of the new account:

```javascript
provider.on('accountChanged', (publicKey) => {
Expand Down
6 changes: 3 additions & 3 deletions getting-started-with-solana/sending-a-transaction-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ await connection.getSignatureStatus(signature);
{% endtab %}
{% endtabs %}

You can also specify a `SendOptions` [object](https://solana-labs.github.io/solana-web3.js/modules.html#SendOptions) as a second argument into `signAndSendTransaction()` or as an `options` parameter when using `request`.
You can also specify a `SendOptions` [object](https://solana-labs.github.io/solana-web3.js/v1.x/modules.html#SendOptions) as a second argument into `signAndSendTransaction()` or as an `options` parameter when using `request`.

For a live demo of signing and sending a Versioned transaction, please refer to the [`handleSignAndSendTransactionV0()`](https://github.com/phantom-labs/sandbox/blob/78dc35fe140140a961345a6af30a058e1e19a7aa/src/App.tsx#L191) section of our developer sandbox.

Expand All @@ -76,7 +76,7 @@ Address Lookup Tables (LUTs) can be used to load accounts into table-like data s

This lookup method effectively "_compresses_" a 32-byte address into a 1-byte index value. This "_compression_" enables storing up to 256 address in a single lookup table for use inside any given transaction.

With the `@solana/web3.js` [`createLookupTable`](https://solana-labs.github.io/solana-web3.js/classes/AddressLookupTableProgram.html#createLookupTable) function, developers can construct the instruction needed to create a new lookup table, as well as determine its address. Once we have the lookup table instruction, we can construct a transaction, sign it, and send it to create a lookup table on-chain. Address lookup tables can be created with either a `v0` transaction or a `legacy` transaction. However, the Solana runtime can only retrieve and handle the additional addresses within a lookup table while using `v0` transactions.
With the `@solana/web3.js` [`createLookupTable`](https://solana-labs.github.io/solana-web3.js/v1.x/classes/AddressLookupTableProgram.html#createLookupTable) function, developers can construct the instruction needed to create a new lookup table, as well as determine its address. Once we have the lookup table instruction, we can construct a transaction, sign it, and send it to create a lookup table on-chain. Address lookup tables can be created with either a `v0` transaction or a `legacy` transaction. However, the Solana runtime can only retrieve and handle the additional addresses within a lookup table while using `v0` transactions.

Here's a code snippet that creates a Lookup Table.

Expand Down Expand Up @@ -106,7 +106,7 @@ Please refer to the [`handleSignAndSendTransactionV0WithLookupTable()`](https://

## Extending an Address Lookup Table (LUT)

Once an Address Lookup Table is created, it can then be extended (i.e. accounts can be appended to the table). Using the `@solana/web3.js` library, you can create a new `extend` instruction using the [`extendLookupTable`](https://solana-labs.github.io/solana-web3.js/classes/AddressLookupTableProgram.html#extendLookupTable) method. Once the extend instruction is created, it can be sent in a transaction.
Once an Address Lookup Table is created, it can then be extended (i.e. accounts can be appended to the table). Using the `@solana/web3.js` library, you can create a new `extend` instruction using the [`extendLookupTable`](https://solana-labs.github.io/solana-web3.js/v1.x/classes/AddressLookupTableProgram.html#extendLookupTable) method. Once the extend instruction is created, it can be sent in a transaction.

{% tabs %}
{% tab title="extendAddressLookupTable()" %}
Expand Down
6 changes: 3 additions & 3 deletions getting-started-with-solana/sending-a-transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In order to send a transaction, a web application must:
3. Optionally await network confirmation using a Solana JSON RPC connection.

{% hint style="info" %}
For more information about the nature of Solana transactions, please review the [`solana-web3.js` docs](https://solana-labs.github.io/solana-web3.js/) as well as the [Solana Cookbook](https://solanacookbook.com/core-concepts/transactions.html#transactions).
For more information about the nature of Solana transactions, please review the [`solana-web3.js` docs](https://solana-labs.github.io/solana-web3.js/v1.x/) as well as the [Solana Cookbook](https://solanacookbook.com/core-concepts/transactions.html#transactions).
{% endhint %}

For a sample Phantom transaction, check out our [developer sandbox](https://github.com/phantom-labs/sandbox/blob/b57fdd0e65ce4f01290141a01e33d17fd2f539b9/src/App.tsx#L160).
Expand Down Expand Up @@ -47,7 +47,7 @@ await connection.getSignatureStatus(signature);
{% endtab %}
{% endtabs %}

You can also specify a `SendOptions` [object](https://solana-labs.github.io/solana-web3.js/modules.html#SendOptions) as a second argument into `signAndSendTransaction` or as an `options` parameter when using `request`.
You can also specify a `SendOptions` [object](https://solana-labs.github.io/solana-web3.js/v1.x/modules.html#SendOptions) as a second argument into `signAndSendTransaction` or as an `options` parameter when using `request`.

For a live demo of `signAndSendTransaction`, please refer to the [`handleSignAndSendTransaction` section of our developer sandbox](https://github.com/phantom-labs/sandbox/blob/b57fdd0e65ce4f01290141a01e33d17fd2f539b9/src/App.tsx#L160).

Expand All @@ -57,7 +57,7 @@ The following methods are also supported, but are not recommended over `signAndS

### Signing a Transaction (Without Sending)

Once a transaction is created, a web application may ask the user's Phantom wallet to sign the transaction _without_ also submitting it to the network. The easiest and most recommended way of doing this is via the `signTransaction` method on the provider, but it is also possible to do via `request`. In both cases, the call will return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Promise) for the signed transaction. After the transaction has been signed, an application may submit the transaction itself via [web3js's `sendRawTransaction`](https://solana-labs.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction).
Once a transaction is created, a web application may ask the user's Phantom wallet to sign the transaction _without_ also submitting it to the network. The easiest and most recommended way of doing this is via the `signTransaction` method on the provider, but it is also possible to do via `request`. In both cases, the call will return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Promise) for the signed transaction. After the transaction has been signed, an application may submit the transaction itself via [web3js's `sendRawTransaction`](https://solana-labs.github.io/solana-web3.js/v1.x/classes/Connection.html#sendRawTransaction).

{% tabs %}
{% tab title="signTransaction()" %}
Expand Down
6 changes: 3 additions & 3 deletions phantom-deeplinks/provider-methods/signalltransactions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SignAllTransactions

Once an app is connected, it is also possible to sign multiple transactions at once. Unlike [SignAndSendTransaction](signandsendtransaction.md), Phantom will not submit these transactions to the network. Applications can submit signed transactions using [web3.js's `sendRawTransaction`](https://solana-labs.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction). 
Once an app is connected, it is also possible to sign multiple transactions at once. Unlike [SignAndSendTransaction](signandsendtransaction.md), Phantom will not submit these transactions to the network. Applications can submit signed transactions using [web3.js's `sendRawTransaction`](https://solana-labs.github.io/solana-web3.js/v1.x/classes/Connection.html#sendRawTransaction). 

### Base URL

Expand All @@ -25,7 +25,7 @@ https://phantom.app/ul/v1/signAllTransactions
}
```

* `transactions` **(required)**: An array of [transactions](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html) that Phantom will sign, serialized and encoded in base58.
* `transactions` **(required)**: An array of [transactions](https://solana-labs.github.io/solana-web3.js/v1.x/classes/Transaction.html) that Phantom will sign, serialized and encoded in base58.
* `session` **(required)**: The session token received from the [Connect](connect.md) method. Please see [Handling Sessions](../handling-sessions.md) for more details.

### Returns
Expand All @@ -45,7 +45,7 @@ https://phantom.app/ul/v1/signAllTransactions
}
```

* `transactions`: An array of signed, serialized transactions that are base58 encoded. Phantom will not submit these transactions. Applications can submit these transactions themselves via [web3.js's `sendRawTransaction`](https://solana-labs.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction). 
* `transactions`: An array of signed, serialized transactions that are base58 encoded. Phantom will not submit these transactions. Applications can submit these transactions themselves via [web3.js's `sendRawTransaction`](https://solana-labs.github.io/solana-web3.js/v1.x/classes/Connection.html#sendRawTransaction). 

#### :x:Reject

Expand Down
6 changes: 3 additions & 3 deletions phantom-deeplinks/provider-methods/signandsendtransaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In order to send a transaction, an application must:
3. Optionally await network confirmation using a Solana JSON RPC connection.

{% hint style="info" %}
For more information about the nature of Solana transactions, please review the [`solana-web3.js` docs](https://solana-labs.github.io/solana-web3.js/) as well as the [Solana Cookbook](https://solanacookbook.com/core-concepts/transactions.html#transactions).
For more information about the nature of Solana transactions, please review the [`solana-web3.js` docs](https://solana-labs.github.io/solana-web3.js/v1.x/) as well as the [Solana Cookbook](https://solanacookbook.com/core-concepts/transactions.html#transactions).
{% endhint %}

For a sample transaction using Phantom deeplinks, check out our [deeplinking demo app](../../resources/sandbox.md#deeplinking-demo-app).
Expand All @@ -35,8 +35,8 @@ https://phantom.app/ul/v1/signAndSendTransaction
}
```

* `transaction` **(required)**: The [transaction](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html) that Phantom will sign and submit, serialized and encoded in base58.
* `sendOptions` (optional): An optional object that specifies options for how Phantom should submit the transaction. This object is [defined in Solana web3.js](https://solana-labs.github.io/solana-web3.js/modules.html#SendOptions).
* `transaction` **(required)**: The [transaction](https://solana-labs.github.io/solana-web3.js/v1.x/classes/Transaction.html) that Phantom will sign and submit, serialized and encoded in base58.
* `sendOptions` (optional): An optional object that specifies options for how Phantom should submit the transaction. This object is [defined in Solana web3.js](https://solana-labs.github.io/solana-web3.js/v1.x/modules.html#SendOptions).
* `session` **(required)**: The session token received from the [Connect](connect.md) method. Please see [Handling Sessions](../handling-sessions.md) for more details.

### Returns
Expand Down
6 changes: 3 additions & 3 deletions phantom-deeplinks/provider-methods/signtransaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The **easiest** and **most recommended** way to send a transaction is via [SignAndSendTransaction](signandsendtransaction.md). It is safer for users, and a simpler API for developers, for Phantom to submit the transaction immediately after signing it instead of relying on the application to do so.

However, it is also possible for an app to request just the signature from Phantom. Once signed, an app can submit the transaction itself using [web3.js's `sendRawTransaction`](https://solana-labs.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction). 
However, it is also possible for an app to request just the signature from Phantom. Once signed, an app can submit the transaction itself using [web3.js's `sendRawTransaction`](https://solana-labs.github.io/solana-web3.js/v1.x/classes/Connection.html#sendRawTransaction). 

### Base URL

Expand All @@ -24,7 +24,7 @@ https://phantom.app/ul/v1/signTransaction
}
```

* `transaction` **(required)**: The [transaction](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html) that Phantom will sign, serialized and encoded in base58.
* `transaction` **(required)**: The [transaction](https://solana-labs.github.io/solana-web3.js/v1.x/classes/Transaction.html) that Phantom will sign, serialized and encoded in base58.
* `session` **(required)**: The session token received from the [Connect](connect.md) method. Please see [Handling Sessions](../handling-sessions.md) for more details.

### Returns
Expand All @@ -41,7 +41,7 @@ https://phantom.app/ul/v1/signTransaction
}
```

* `transaction`: The signed, serialized transaction that is base58 encoded. Phantom will not submit this transactions. An application can submit this transactions itself via [web3.js's sendRawTransaction](https://solana-labs.github.io/solana-web3.js/classes/Connection.html#sendRawTransaction).
* `transaction`: The signed, serialized transaction that is base58 encoded. Phantom will not submit this transactions. An application can submit this transactions itself via [web3.js's sendRawTransaction](https://solana-labs.github.io/solana-web3.js/v1.x/classes/Connection.html#sendRawTransaction).

#### :x:Reject

Expand Down