Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: solana-labs/solana-web3.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 168d5e088edd48f9f0c1a877e888592ca4cfdf38
Choose a base ref
...
head repository: solana-labs/solana-web3.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ae708cef51246c9a75cf8c5031d9e90f5cb0c06a
Choose a head ref
Loading
Showing with 27,774 additions and 14,109 deletions.
  1. +0 −1 .eslintignore
  2. +1 −8 .eslintrc.js
  3. +0 −11 .flowconfig
  4. +48 −0 .github/workflows/cicd.yml
  5. +0 −6 .mocharc.js
  6. +0 −1 .prettierignore
  7. +15 −8 .travis/before_install.sh
  8. +1 −3 .travis/script.sh
  9. +12 −14 README.md
  10. +0 −25 examples/get_account_info.js
  11. +0 −37 examples/send_sol.js
  12. +0 −21 mocha.html
  13. +8,991 −11,765 package-lock.json
  14. +33 −37 package.json
  15. +100 −41 rollup.config.js
  16. +6 −3 scripts/typegen.sh
  17. +4 −0 src/__forks__/browser/fetch-impl.ts
  18. +4 −0 src/__forks__/react-native/fetch-impl.ts
  19. +39 −0 src/account-data.ts
  20. +19 −10 src/account.ts
  21. +2,059 −781 src/connection.ts
  22. +41 −0 src/errors.ts
  23. +2 −0 src/fee-calculator.ts
  24. +13 −0 src/fetch-impl.ts
  25. +3 −9 src/index.ts
  26. +15 −5 src/instruction.ts
  27. +19 −24 src/keypair.ts
  28. +96 −22 src/layout.ts
  29. +19 −6 src/loader.ts
  30. +45 −0 src/message/index.ts
  31. +67 −31 src/{message.ts → message/legacy.ts}
  32. +324 −0 src/message/v0.ts
  33. +36 −0 src/message/versioned.ts
  34. +16 −3 src/nonce-account.ts
  35. +435 −0 src/programs/address-lookup-table/index.ts
  36. +84 −0 src/programs/address-lookup-table/state.ts
  37. +278 −0 src/programs/compute-budget.ts
  38. +27 −10 src/{ed25519-program.ts → programs/ed25519.ts}
  39. +7 −0 src/programs/index.ts
  40. +25 −10 src/{secp256k1-program.ts → programs/secp256k1.ts}
  41. +156 −44 src/{stake-program.ts → programs/stake.ts}
  42. +151 −50 src/{system-program.ts → programs/system.ts}
  43. +434 −0 src/programs/vote.ts
  44. +50 −81 src/publickey.ts
  45. +16 −4 src/sysvar.ts
  46. +12 −0 src/transaction/constants.ts
  47. +35 −0 src/transaction/expiry-custom-errors.ts
  48. +4 −0 src/transaction/index.ts
  49. +207 −56 src/{transaction.ts → transaction/legacy.ts}
  50. +105 −0 src/transaction/versioned.ts
  51. +0 −46 src/util/send-and-confirm-raw-transaction.ts
  52. +0 −18 src/util/url.ts
  53. 0 src/{util → utils}/assert.ts
  54. +43 −0 src/utils/bigint.ts
  55. 0 src/{util → utils}/borsh-schema.ts
  56. +2 −2 src/{util → utils}/cluster.ts
  57. +46 −0 src/utils/ed25519.ts
  58. +5 −0 src/utils/index.ts
  59. +26 −0 src/utils/makeWebsocketUrl.ts
  60. 0 src/{util → utils}/promise-timeout.ts
  61. +18 −0 src/utils/secp256k1.ts
  62. +92 −0 src/utils/send-and-confirm-raw-transaction.ts
  63. +21 −6 src/{util → utils}/send-and-confirm-transaction.ts
  64. 0 src/{util → utils}/shortvec-encoding.ts
  65. 0 src/{util → utils}/sleep.ts
  66. 0 src/{util → utils}/to-buffer.ts
  67. +4 −6 src/validator-info.ts
  68. +138 −37 src/vote-account.ts
  69. +1 −1 test/agent-manager.test.ts
  70. +22 −3 test/bpf-loader.test.ts
  71. +1 −1 test/cluster.test.ts
  72. +951 −0 test/connection-subscriptions.test.ts
  73. +1,830 −641 test/connection.test.ts
  74. +1 −1 test/fixtures/noop-program/Cargo.toml
  75. +0 −2 test/fixtures/noop-program/Xargo.toml
  76. BIN test/fixtures/noop-program/solana_bpf_rust_noop.so
  77. +10 −4 test/fixtures/noop-program/src/lib.rs
  78. +52 −0 test/makeWebsocketUrl.test.ts
  79. +56 −0 test/message-tests/v0.test.ts
  80. +28 −0 test/message-tests/versioned.test.ts
  81. +78 −23 test/mocks/rpc-http.ts
  82. +25 −6 test/mocks/rpc-websockets.ts
  83. +266 −0 test/program-tests/address-lookup-table.test.ts
  84. +220 −0 test/program-tests/compute-budget.test.ts
  85. +4 −4 test/{ed25519-program.test.ts → program-tests/ed25519.test.ts}
  86. +16 −9 test/{secp256k1-program.test.ts → program-tests/secp256k1.test.ts}
  87. +118 −34 test/{stake-program.test.ts → program-tests/stake.test.ts}
  88. +17 −7 test/{system-program.test.ts → program-tests/system.test.ts}
  89. +280 −0 test/program-tests/vote.test.ts
  90. +24 −0 test/publickey.test.ts
  91. +0 −61 test/rollup.config.js
  92. +1 −1 test/shortvec-encoding.test.ts
  93. +2 −2 test/transaction-payer.test.ts
  94. +518 −61 test/transaction.test.ts
  95. +2 −4 test/validator-info.test.ts
  96. +4 −1 test/websocket.test.ts
  97. +3 −1 tsconfig.json
  98. +1 −0 typedoc.json
  99. +8,794 −0 yarn.lock
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
/deploy
/doc
/lib
/module.flow.js
/.eslintrc.js
/test/.eslintrc.js
/test/dist
9 changes: 1 addition & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -31,17 +31,10 @@ module.exports = {
'newlines-between': 'always',
},
],
indent: [
'error',
2,
{
MemberExpression: 1,
SwitchCase: 1,
},
],
'linebreak-style': ['error', 'unix'],
'no-console': [0],
'no-trailing-spaces': ['error'],
'no-undef': 'off',
'no-unused-vars': 'off',
quotes: [
'error',
11 changes: 0 additions & 11 deletions .flowconfig

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI/CD

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: "npm"

- name: Build
run: |
sh -c "$(curl -sSfL https://release.solana.com/edge/install)"
PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
solana --version
npm install -g npm@7
npm install
npm run build
ls -l lib
test -r lib/index.iife.js
test -r lib/index.cjs.js
test -r lib/index.esm.js
npm run ok
npm run codecov
npm run test:live-with-test-validator
- name: Publish NPM
run: |
npx semantic-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Deploy Github Page
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc
6 changes: 0 additions & 6 deletions .mocharc.js

This file was deleted.

1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
test/dist
module.flow.js
declarations
23 changes: 15 additions & 8 deletions .travis/before_install.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# |source| this file

wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main"
sudo apt-get update
sudo apt-get install -y clang-7 --allow-unauthenticated
sudo apt-get install -y openssl --allow-unauthenticated
sudo apt-get install -y libssl-dev --allow-unauthenticated
sudo apt-get install -y libssl1.1 --allow-unauthenticated
clang-7 --version
if [[ -n $TRAVIS ]]; then
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main"
sudo apt-get update
sudo apt-get install -y clang-7 --allow-unauthenticated
sudo apt-get install -y openssl --allow-unauthenticated
sudo apt-get install -y libssl-dev --allow-unauthenticated
sudo apt-get install -y libssl1.1 --allow-unauthenticated
clang-7 --version
fi

sh -c "$(curl -sSfL https://release.solana.com/edge/install)"
PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
solana --version

if [[ -n $GITHUB_ACTIONS ]]; then
echo "$HOME/.local/share/solana/install/active_release/bin" >> "$GITHUB_PATH"
npm install -g npm@7
fi
4 changes: 1 addition & 3 deletions .travis/script.sh
Original file line number Diff line number Diff line change
@@ -9,8 +9,6 @@ ls -l lib
test -r lib/index.iife.js
test -r lib/index.cjs.js
test -r lib/index.esm.js
npm run doc
npm run lint
npm run ok
npm run codecov
npm run test:live-with-test-validator
npm run test:browser-with-test-validator
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -23,7 +23,10 @@

This is the Solana Javascript API built on the Solana [JSON RPC API](https://docs.solana.com/apps/jsonrpc-api)

[Latest API Documentation](https://solana-labs.github.io/solana-web3.js/)
## Documentation and examples

- [The Solana Cookbook](https://solanacookbook.com/) has extensive task-based documentation using this library.
- For more detail on individual functions, see the [latest API Documentation](https://solana-labs.github.io/solana-web3.js/)

## Installation

@@ -84,20 +87,11 @@ console.log(solanaWeb3);
console.log(solanaWeb3);
```

## Examples

Example scripts for the web3.js repo and native programs:

- [Web3 Examples](https://github.com/solana-labs/solana/tree/master/web3.js/examples)

Example scripts for the Solana Program Library:
## Flow Support (Discontinued)

- [Token Program Examples](https://github.com/solana-labs/solana-program-library/tree/master/token/js/examples)

## Flow

A [Flow library definition](https://flow.org/en/docs/libdefs/) is provided at
https://unpkg.com/@solana/web3.js@latest/module.flow.js.
Flow types are no longer supported in new releases. The last release with Flow support is v1.37.2 and its
[Flow library definition](https://flow.org/en/docs/libdefs/) is provided at
https://unpkg.com/@solana/web3.js@v1.37.2/module.flow.js.
Download the file and add the following line under the [libs] section of your project's `.flowconfig` to
activate it:

@@ -115,6 +109,10 @@ Each Github release features a tarball containing API documentation and a
minified version of the module suitable for direct use in a browser environment
(`<script>` tag)

## Contributing

If you have an issue to report or would like to contribute a pull request, please do so against the monorepo at https://github.com/solana-labs/solana. We are not able to merge pull requests into the mirror repo https://github.com/solana-labs/solana-web3.js and issues filed there may go unnoticed.

## Disclaimer

All claims, content, designs, algorithms, estimates, roadmaps,
25 changes: 0 additions & 25 deletions examples/get_account_info.js

This file was deleted.

37 changes: 0 additions & 37 deletions examples/send_sol.js

This file was deleted.

21 changes: 0 additions & 21 deletions mocha.html

This file was deleted.

Loading