Skip to content

Commit

Permalink
Use @coral-xyz/borsh package
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto committed Dec 2, 2022
1 parent 66e4295 commit 35e48fd
Show file tree
Hide file tree
Showing 24 changed files with 313 additions and 296 deletions.
2 changes: 2 additions & 0 deletions .github/actions/setup-ts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ runs:
path: |
./ts/dist/
key: solana-${{ runner.os }}-v0000-${{ env.NODE_VERSION }}-${{ hashFiles('./ts/**/*.ts') }}
- run: cd ts/packages/borsh && yarn --frozen-lockfile && yarn build && cd ../../../
shell: bash
- run: cd ts/packages/anchor && yarn --frozen-lockfile && yarn build:node && yarn link && cd ../../../
shell: bash
- run: cd ts/packages/spl-associated-token-account && yarn --frozen-lockfile && yarn build:node && yarn link && cd ../../../
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/no-cashing-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
- run: cargo test
# using singlethreaded testing for avm so that tests that change files do not conflict with each other
- run: cd avm && cargo fmt -- --check && cargo clippy --all-targets -- -D warnings && cargo test -- --test-threads=1
# Init local borsh package
- run: cd ts/packages/borsh && yarn --frozen-lockfile && yarn build
- run: cd ts/packages/anchor && yarn --frozen-lockfile
- run: cd ts/packages/anchor && yarn test
- run: cd ts/packages/anchor && yarn lint
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- run: cargo test
# using singlethreaded testing for avm so that tests that change files do not conflict with each other
- run: cd avm && cargo fmt -- --check && cargo clippy --all-targets -- -D warnings && cargo test -- --test-threads=1
- run: cd ts/packages/borsh && yarn --frozen-lockfile && yarn build
- run: cd ts/packages/anchor && yarn --frozen-lockfile
- run: cd ts/packages/anchor && yarn test
- run: cd ts/packages/anchor && yarn lint
Expand Down
4 changes: 2 additions & 2 deletions ts/packages/anchor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"test": "jest tests --detectOpenHandles"
},
"dependencies": {
"@project-serum/borsh": "^0.2.5",
"@solana/web3.js": "^1.64.0",
"@coral-xyz/borsh": "^0.2.6",
"@solana/web3.js": "^1.68.0",
"base64-js": "^1.5.1",
"bn.js": "^5.1.2",
"bs58": "^4.0.1",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/anchor/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
}),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/anchor/src/coder/borsh/idl.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import camelCase from "camelcase";
import { Layout } from "buffer-layout";
import * as borsh from "@project-serum/borsh";
import * as borsh from "@coral-xyz/borsh";
import { IdlField, IdlTypeDef, IdlEnumVariant, IdlType } from "../../idl.js";
import { IdlError } from "../../error.js";

Expand Down
2 changes: 1 addition & 1 deletion ts/packages/anchor/src/coder/borsh/instruction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Layout } from "buffer-layout";
import camelCase from "camelcase";
import { snakeCase } from "snake-case";
import { sha256 } from "js-sha256";
import * as borsh from "@project-serum/borsh";
import * as borsh from "@coral-xyz/borsh";
import { AccountMeta, PublicKey } from "@solana/web3.js";
import {
Idl,
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/anchor/src/idl.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Buffer } from "buffer";
import { PublicKey } from "@solana/web3.js";
import * as borsh from "@project-serum/borsh";
import * as borsh from "@coral-xyz/borsh";

export type Idl = {
version: string;
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/anchor/src/utils/registry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BN from "bn.js";
import fetch from "cross-fetch";
import * as borsh from "@project-serum/borsh";
import * as borsh from "@coral-xyz/borsh";
import { Connection, PublicKey } from "@solana/web3.js";

/**
Expand Down
7 changes: 5 additions & 2 deletions ts/packages/borsh/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
"buffer-layout": "^1.2.0"
},
"peerDependencies": {
"@solana/web3.js": "^1.2.0"
"@solana/web3.js": "^1.68.0"
},
"files": [
"dist"
]
],
"devDependencies": {
"@types/node": "^18.11.10"
}
}
2 changes: 1 addition & 1 deletion ts/packages/spl-associated-token-account/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-binary-option/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-binary-oracle-pair/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-feature-proposal/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-governance/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-memo/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-name-service/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-record/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-stake-pool/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-stateless-asks/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-token-lending/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-token-swap/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/spl-token/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
terser(),
],
external: [
"@project-serum/borsh",
"@coral-xyz/borsh",
"@solana/web3.js",
"assert",
"base64-js",
Expand Down

0 comments on commit 35e48fd

Please sign in to comment.