Skip to content

Commit

Permalink
Remove @solana/web3.js code from repo (#186)
Browse files Browse the repository at this point in the history
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
dependabot[bot] authored Mar 6, 2025
1 parent 8f78882 commit b1f6e35
Show file tree
Hide file tree
Showing 51 changed files with 70 additions and 3,039 deletions.
6 changes: 3 additions & 3 deletions examples/deserialize-transaction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"test:typecheck": "tsc"
},
"dependencies": {
"@solana-program/memo": "^0.6.1",
"@solana-program/system": "^0.6.2",
"@solana-program/memo": "^0.7.0",
"@solana-program/system": "^0.7.0",
"@solana/example-utils": "workspace:*",
"@solana/web3.js": "workspace:*"
"@solana/kit": "workspace:*"
},
"devDependencies": {
"start-server-and-test": "^2.0.10",
Expand Down
14 changes: 7 additions & 7 deletions examples/deserialize-transaction/src/example.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* EXAMPLE
* Deserialize and inspect a transaction with @solana/web3.js.
* Deserialize and inspect a transaction with @solana/kit
*
* Before running any of the examples in this monorepo, make sure to set up a test validator by
* running `pnpm test:live-with-test-validator:setup` in the root directory.
Expand Down Expand Up @@ -32,7 +32,7 @@ import {
setTransactionMessageFeePayer,
setTransactionMessageLifetimeUsingBlockhash,
verifySignature,
} from '@solana/web3.js';
} from '@solana/kit';
import { getAddMemoInstruction, MEMO_PROGRAM_ADDRESS, parseAddMemoInstruction } from '@solana-program/memo';
import {
getTransferSolInstruction,
Expand Down Expand Up @@ -113,7 +113,7 @@ const transactionMessage = pipe(
source: SOURCE_ACCOUNT_SIGNER,
}),
getAddMemoInstruction({
memo: 'hello from @solana/web3.js',
memo: 'hello from @solana/kit',
}),
],
tx,
Expand Down Expand Up @@ -179,7 +179,7 @@ log.info(`[setup] Encoded the transaction as base64: ${base64EncodedTransaction.

/**
* STEP 1: DECODE TO TRANSACTION
* @solana/web3.js has encoders/decoders for many Solana data structures and common data formats,
* @solana/kit has encoders/decoders for many Solana data structures and common data formats,
* including both base64 strings and our `Transaction` data structure
* To convert between these, we first encode to a byte array, and then decode to the
* desired data structure.
Expand Down Expand Up @@ -366,7 +366,7 @@ log.info(decompiledTransactionMessage.instructions[0].data, '[step 3] The data b
* STEP 4: PARSING THE INSTRUCTIONS
* To understand what is actually happening in each instruction, we need to decode the data field
* We will do this by using the generated `@solana-program/system` client, which can decode data
* from the @solana/web3.js instruction data structure for the System program
* from the @solana/kit instruction data structure for the System program
* We know from the program address (11111111111111111111111111111111) that the first instruction
* is to the system program
* You can generate such a client for any Solana program using Codama
Expand All @@ -385,7 +385,7 @@ if (identifiedInstruction === SystemInstruction.TransferSol) {
assertIsInstructionWithAccounts(firstInstruction);

// TODO: This can just be `parseTransferSolInstruction(firstInstruction)` when the client is updated
// with the `@solana/web3.js` version that changes the instruction data type to `ReadonlyUint8Array`
// with the `@solana/kit` version that changes the instruction data type to `ReadonlyUint8Array`
const parsedFirstInstruction = parseTransferSolInstruction({
...firstInstruction,
data: firstInstruction.data as unknown as Uint8Array,
Expand Down Expand Up @@ -416,7 +416,7 @@ if (secondInstruction.programAddress === MEMO_PROGRAM_ADDRESS) {
assertIsInstructionWithData(secondInstruction);

// TODO: This can just be `parseAddMemoInstruction(secondInstruction)` when the client is updated
// with the `@solana/web3.js` version that changes the instruction data type to `ReadonlyUint8Array`
// with the `@solana/kit` version that changes the instruction data type to `ReadonlyUint8Array`
const parsedSecondInstruction = parseAddMemoInstruction({
...secondInstruction,
data: secondInstruction.data as unknown as Uint8Array,
Expand Down
4 changes: 2 additions & 2 deletions examples/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"@radix-ui/react-dropdown-menu": "2.1.6",
"@radix-ui/react-icons": "1.3.2",
"@radix-ui/themes": "3.2.0",
"@solana-program/system": "^0.6.2",
"@solana-program/system": "^0.7.0",
"@solana/kit": "workspace:*",
"@solana/react": "workspace:*",
"@solana/web3.js": "workspace:*",
"@wallet-standard/core": "^1.1.0",
"@wallet-standard/react": "^1.0.0",
"react": "^19",
Expand Down
2 changes: 1 addition & 1 deletion examples/react-app/src/components/Balance.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ExclamationTriangleIcon } from '@radix-ui/react-icons';
import { Text, Tooltip } from '@radix-ui/themes';
import { address } from '@solana/web3.js';
import { address } from '@solana/kit';
import type { UiWalletAccount } from '@wallet-standard/react';
import { useContext, useMemo } from 'react';
import useSWRSubscription from 'swr/subscription';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Pencil1Icon } from '@radix-ui/react-icons';
import { Blockquote, Box, Button, Code, DataList, Dialog, Flex, TextField } from '@radix-ui/themes';
import { getBase64Decoder } from '@solana/web3.js';
import { getBase64Decoder } from '@solana/kit';
import type { ReadonlyUint8Array } from '@wallet-standard/core';
import type { SyntheticEvent } from 'react';
import { useRef, useState } from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Blockquote, Box, Button, Dialog, Flex, Link, Select, Text, TextField } from '@radix-ui/themes';
import { useWalletAccountTransactionSendingSigner } from '@solana/react';
import {
address,
appendTransactionMessageInstruction,
Expand All @@ -11,7 +10,8 @@ import {
setTransactionMessageFeePayerSigner,
setTransactionMessageLifetimeUsingBlockhash,
signAndSendTransactionMessageWithSigners,
} from '@solana/web3.js';
} from '@solana/kit';
import { useWalletAccountTransactionSendingSigner } from '@solana/react';
import { getTransferSolInstruction } from '@solana-program/system';
import { getUiWalletAccountStorageKey, type UiWalletAccount, useWallets } from '@wallet-standard/react';
import type { SyntheticEvent } from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Address } from '@solana/kit';
import { useWalletAccountMessageSigner } from '@solana/react';
import type { Address } from '@solana/web3.js';
import type { ReadonlyUint8Array } from '@wallet-standard/core';
import type { UiWalletAccount } from '@wallet-standard/react';
import { useCallback } from 'react';
Expand Down
4 changes: 2 additions & 2 deletions examples/react-app/src/context/ChainContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ClusterUrl } from '@solana/web3.js';
import { devnet } from '@solana/web3.js';
import type { ClusterUrl } from '@solana/kit';
import { devnet } from '@solana/kit';
import { createContext } from 'react';

export type ChainContext = Readonly<{
Expand Down
2 changes: 1 addition & 1 deletion examples/react-app/src/context/ChainContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mainnet, testnet } from '@solana/web3.js';
import { mainnet, testnet } from '@solana/kit';
import { useMemo, useState } from 'react';

import { ChainContext, DEFAULT_CHAIN_CONFIG } from './ChainContext';
Expand Down
4 changes: 2 additions & 2 deletions examples/react-app/src/context/RpcContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Rpc, RpcSubscriptions, SolanaRpcApiMainnet, SolanaRpcSubscriptionsApi } from '@solana/web3.js';
import { createSolanaRpc, createSolanaRpcSubscriptions, devnet } from '@solana/web3.js';
import type { Rpc, RpcSubscriptions, SolanaRpcApiMainnet, SolanaRpcSubscriptionsApi } from '@solana/kit';
import { createSolanaRpc, createSolanaRpcSubscriptions, devnet } from '@solana/kit';
import { createContext } from 'react';

export const RpcContext = createContext<{
Expand Down
2 changes: 1 addition & 1 deletion examples/react-app/src/context/RpcContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createSolanaRpc, createSolanaRpcSubscriptions } from '@solana/web3.js';
import { createSolanaRpc, createSolanaRpcSubscriptions } from '@solana/kit';
import { ReactNode, useContext, useMemo } from 'react';

import { ChainContext } from './ChainContext';
Expand Down
2 changes: 1 addition & 1 deletion examples/react-app/src/functions/balance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AccountNotificationsApi, Address, GetBalanceApi, Lamports, Rpc, RpcSubscriptions } from '@solana/web3.js';
import { AccountNotificationsApi, Address, GetBalanceApi, Lamports, Rpc, RpcSubscriptions } from '@solana/kit';
import { SWRSubscription } from 'swr/subscription';

const EXPLICIT_ABORT_TOKEN = Symbol();
Expand Down
2 changes: 1 addition & 1 deletion examples/rpc-custom-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@solana/example-utils": "workspace:*",
"@solana/web3.js": "workspace:*"
"@solana/kit": "workspace:*"
},
"devDependencies": {
"tsx": "^4.19.3"
Expand Down
4 changes: 2 additions & 2 deletions examples/rpc-custom-api/src/example.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* EXAMPLE
* Add a custom JSON RPC method to the base Solana JSON RPC API using @solana/web3.js.
* Add a custom JSON RPC method to the base Solana JSON RPC API using @solana/kit.
*
* To run this example, execute `pnpm start` in this directory.
*/
Expand All @@ -17,7 +17,7 @@ import {
RpcApi,
RpcPlan,
SolanaRpcApiMainnet,
} from '@solana/web3.js';
} from '@solana/kit';

const log = createLogger('Custom JSON RPC API');

Expand Down
2 changes: 1 addition & 1 deletion examples/rpc-transport-throttled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@solana/example-utils": "workspace:*",
"@solana/web3.js": "workspace:*"
"@solana/kit": "workspace:*"
},
"devDependencies": {
"start-server-and-test": "^2.0.10",
Expand Down
2 changes: 1 addition & 1 deletion examples/rpc-transport-throttled/src/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
createSolanaRpcFromTransport,
mainnet,
RpcTransportFromClusterUrl,
} from '@solana/web3.js';
} from '@solana/kit';

const log = createLoggerWithTimestamp('Throttling transport');

Expand Down
4 changes: 2 additions & 2 deletions examples/signers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"test:typecheck": "tsc"
},
"dependencies": {
"@solana-program/system": "^0.6.2",
"@solana-program/system": "^0.7.0",
"@solana/example-utils": "workspace:*",
"@solana/web3.js": "workspace:*"
"@solana/kit": "workspace:*"
},
"devDependencies": {
"start-server-and-test": "^2.0.10",
Expand Down
4 changes: 2 additions & 2 deletions examples/signers/src/example.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* EXAMPLE
* Create and use signers with @solana/web3.js.
* Create and use signers with @solana/kit.
*
* Before running any of the examples in this monorepo, make sure to set up a test validator by
* running `pnpm test:live-with-test-validator:setup` in the root directory.
Expand Down Expand Up @@ -28,7 +28,7 @@ import {
setTransactionMessageLifetimeUsingBlockhash,
TransactionPartialSigner,
TransactionSigner,
} from '@solana/web3.js';
} from '@solana/kit';
import { getTransferSolInstruction } from '@solana-program/system';
import { readFile } from 'fs/promises';
import path from 'path';
Expand Down
4 changes: 2 additions & 2 deletions examples/transfer-lamports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"test:typecheck": "tsc"
},
"dependencies": {
"@solana-program/system": "^0.6.2",
"@solana-program/system": "^0.7.0",
"@solana/example-utils": "workspace:*",
"@solana/web3.js": "workspace:*"
"@solana/kit": "workspace:*"
},
"devDependencies": {
"start-server-and-test": "^2.0.10",
Expand Down
4 changes: 2 additions & 2 deletions examples/transfer-lamports/src/example.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* EXAMPLE
* Transfer Lamports from one account to another with @solana/web3.js.
* Transfer Lamports from one account to another with @solana/kit.
*
* Before running any of the examples in this monorepo, make sure to set up a test validator by
* running `pnpm test:live-with-test-validator:setup` in the root directory.
Expand All @@ -25,7 +25,7 @@ import {
setTransactionMessageLifetimeUsingBlockhash,
signTransactionMessageWithSigners,
SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,
} from '@solana/web3.js';
} from '@solana/kit';
import { getSystemErrorMessage, getTransferSolInstruction, isSystemError } from '@solana-program/system';

const log = createLogger('Transfer');
Expand Down
1 change: 0 additions & 1 deletion packages/library/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion packages/library/.npmrc

This file was deleted.

4 changes: 0 additions & 4 deletions packages/library/.prettierignore

This file was deleted.

Loading

0 comments on commit b1f6e35

Please sign in to comment.