Skip to content

Commit

Permalink
Bump Kinobi to 0.21.0 and web3.js to tp4 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva authored Jul 17, 2024
1 parent 81b4799 commit cbf5c38
Show file tree
Hide file tree
Showing 50 changed files with 1,190 additions and 1,115 deletions.
3 changes: 0 additions & 3 deletions clients/js/env-shim.ts

This file was deleted.

21 changes: 11 additions & 10 deletions clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,25 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@solana/web3.js": "2.0.0-preview.3"
"@solana/web3.js": "2.0.0-preview.4"
},
"devDependencies": {
"@ava/typescript": "^4.1.0",
"@solana/eslint-config-solana": "^3.0.0",
"@solana/web3.js": "2.0.0-preview.3.20240509193256.24c3f0f6d696e7317461cddfac56fa2c264acf27",
"@solana/webcrypto-ed25519-polyfill": "2.0.0-preview.3.20240509193256.24c3f0f6d696e7317461cddfac56fa2c264acf27",
"@solana-program/system": "^0.3.2",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"ava": "^6.1.2",
"@solana-program/system": "^0.4.0",
"@solana/eslint-config-solana": "^3.0.3",
"@solana/web3.js": "2.0.0-preview.4",
"@solana/webcrypto-ed25519-polyfill": "2.0.0-preview.4",
"@types/node": "^20",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"ava": "^6.1.3",
"eslint": "^8.57.0",
"prettier": "^3.2.5",
"prettier": "^3.3.3",
"rimraf": "^5.0.5",
"tsup": "^8.0.2",
"typedoc": "^0.25.12",
"typedoc-plugin-missing-exports": "^2.2.0",
"typescript": "^5.4.2"
"typescript": "^5.5.3"
},
"ava": {
"require": [
Expand Down
834 changes: 424 additions & 410 deletions clients/js/pnpm-lock.yaml

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions clients/js/src/generated/accounts/mint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@
*/

import {
Account,
Address,
Codec,
Decoder,
EncodedAccount,
Encoder,
FetchAccountConfig,
FetchAccountsConfig,
MaybeAccount,
MaybeEncodedAccount,
Option,
OptionOrNullable,
assertAccountExists,
assertAccountsExist,
combineCodec,
Expand Down Expand Up @@ -46,12 +34,24 @@ import {
getU8Decoder,
getU8Encoder,
padLeftEncoder,
type Account,
type Address,
type Codec,
type Decoder,
type EncodedAccount,
type Encoder,
type FetchAccountConfig,
type FetchAccountsConfig,
type MaybeAccount,
type MaybeEncodedAccount,
type Option,
type OptionOrNullable,
} from '@solana/web3.js';
import {
Extension,
ExtensionArgs,
getExtensionDecoder,
getExtensionEncoder,
type Extension,
type ExtensionArgs,
} from '../types';

export type Mint = {
Expand Down Expand Up @@ -98,7 +98,7 @@ export function getMintEncoder(): Encoder<MintArgs> {
'mintAuthority',
getOptionEncoder(getAddressEncoder(), {
prefix: getU32Encoder(),
fixed: true,
noneValue: 'zeroes',
}),
],
['supply', getU64Encoder()],
Expand All @@ -108,7 +108,7 @@ export function getMintEncoder(): Encoder<MintArgs> {
'freezeAuthority',
getOptionEncoder(getAddressEncoder(), {
prefix: getU32Encoder(),
fixed: true,
noneValue: 'zeroes',
}),
],
[
Expand All @@ -127,7 +127,7 @@ export function getMintDecoder(): Decoder<Mint> {
'mintAuthority',
getOptionDecoder(getAddressDecoder(), {
prefix: getU32Decoder(),
fixed: true,
noneValue: 'zeroes',
}),
],
['supply', getU64Decoder()],
Expand All @@ -137,7 +137,7 @@ export function getMintDecoder(): Decoder<Mint> {
'freezeAuthority',
getOptionDecoder(getAddressDecoder(), {
prefix: getU32Decoder(),
fixed: true,
noneValue: 'zeroes',
}),
],
[
Expand Down
20 changes: 10 additions & 10 deletions clients/js/src/generated/accounts/multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@
*/

import {
Account,
Address,
Codec,
Decoder,
EncodedAccount,
Encoder,
FetchAccountConfig,
FetchAccountsConfig,
MaybeAccount,
MaybeEncodedAccount,
assertAccountExists,
assertAccountsExist,
combineCodec,
Expand All @@ -33,6 +23,16 @@ import {
getStructEncoder,
getU8Decoder,
getU8Encoder,
type Account,
type Address,
type Codec,
type Decoder,
type EncodedAccount,
type Encoder,
type FetchAccountConfig,
type FetchAccountsConfig,
type MaybeAccount,
type MaybeEncodedAccount,
} from '@solana/web3.js';

export type Multisig = {
Expand Down
44 changes: 22 additions & 22 deletions clients/js/src/generated/accounts/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@
*/

import {
Account,
Address,
Codec,
Decoder,
EncodedAccount,
Encoder,
FetchAccountConfig,
FetchAccountsConfig,
MaybeAccount,
MaybeEncodedAccount,
Option,
OptionOrNullable,
assertAccountExists,
assertAccountsExist,
combineCodec,
Expand All @@ -42,16 +30,28 @@ import {
getU64Decoder,
getU64Encoder,
getU8Encoder,
type Account,
type Address,
type Codec,
type Decoder,
type EncodedAccount,
type Encoder,
type FetchAccountConfig,
type FetchAccountsConfig,
type MaybeAccount,
type MaybeEncodedAccount,
type Option,
type OptionOrNullable,
} from '@solana/web3.js';
import {
AccountState,
AccountStateArgs,
Extension,
ExtensionArgs,
getAccountStateDecoder,
getAccountStateEncoder,
getExtensionDecoder,
getExtensionEncoder,
type AccountState,
type AccountStateArgs,
type Extension,
type ExtensionArgs,
} from '../types';

export type Token = {
Expand Down Expand Up @@ -121,23 +121,23 @@ export function getTokenEncoder(): Encoder<TokenArgs> {
'delegate',
getOptionEncoder(getAddressEncoder(), {
prefix: getU32Encoder(),
fixed: true,
noneValue: 'zeroes',
}),
],
['state', getAccountStateEncoder()],
[
'isNative',
getOptionEncoder(getU64Encoder(), {
prefix: getU32Encoder(),
fixed: true,
noneValue: 'zeroes',
}),
],
['delegatedAmount', getU64Encoder()],
[
'closeAuthority',
getOptionEncoder(getAddressEncoder(), {
prefix: getU32Encoder(),
fixed: true,
noneValue: 'zeroes',
}),
],
[
Expand All @@ -159,23 +159,23 @@ export function getTokenDecoder(): Decoder<Token> {
'delegate',
getOptionDecoder(getAddressDecoder(), {
prefix: getU32Decoder(),
fixed: true,
noneValue: 'zeroes',
}),
],
['state', getAccountStateDecoder()],
[
'isNative',
getOptionDecoder(getU64Decoder(), {
prefix: getU32Decoder(),
fixed: true,
noneValue: 'zeroes',
}),
],
['delegatedAmount', getU64Decoder()],
[
'closeAuthority',
getOptionDecoder(getAddressDecoder(), {
prefix: getU32Decoder(),
fixed: true,
noneValue: 'zeroes',
}),
],
[
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/errors/associatedToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type AssociatedTokenError = typeof ASSOCIATED_TOKEN_ERROR__INVALID_OWNER;
let associatedTokenErrorMessages:
| Record<AssociatedTokenError, string>
| undefined;
if (__DEV__) {
if (process.env.NODE_ENV !== 'production') {
associatedTokenErrorMessages = {
[ASSOCIATED_TOKEN_ERROR__INVALID_OWNER]: `Associated token account owner does not match address derivation`,
};
Expand All @@ -23,11 +23,11 @@ if (__DEV__) {
export function getAssociatedTokenErrorMessage(
code: AssociatedTokenError
): string {
if (__DEV__) {
if (process.env.NODE_ENV !== 'production') {
return (
associatedTokenErrorMessages as Record<AssociatedTokenError, string>
)[code];
}

return 'Error message not available in production bundles. Compile with `__DEV__` set to true to see more information.';
return 'Error message not available in production bundles.';
}
6 changes: 3 additions & 3 deletions clients/js/src/generated/errors/token2022.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export type Token2022Error =
| typeof TOKEN_2022_ERROR__UNINITIALIZED_STATE;

let token2022ErrorMessages: Record<Token2022Error, string> | undefined;
if (__DEV__) {
if (process.env.NODE_ENV !== 'production') {
token2022ErrorMessages = {
[TOKEN_2022_ERROR__ACCOUNT_FROZEN]: `Account is frozen`,
[TOKEN_2022_ERROR__ALREADY_IN_USE]: `Already in use`,
Expand All @@ -96,9 +96,9 @@ if (__DEV__) {
}

export function getToken2022ErrorMessage(code: Token2022Error): string {
if (__DEV__) {
if (process.env.NODE_ENV !== 'production') {
return (token2022ErrorMessages as Record<Token2022Error, string>)[code];
}

return 'Error message not available in production bundles. Compile with `__DEV__` set to true to see more information.';
return 'Error message not available in production bundles.';
}
11 changes: 0 additions & 11 deletions clients/js/src/generated/global.d.ts

This file was deleted.

20 changes: 10 additions & 10 deletions clients/js/src/generated/instructions/amountToUiAmount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@
*/

import {
Address,
Codec,
Decoder,
Encoder,
IAccountMeta,
IInstruction,
IInstructionWithAccounts,
IInstructionWithData,
ReadonlyAccount,
combineCodec,
getStructDecoder,
getStructEncoder,
Expand All @@ -24,9 +15,18 @@ import {
getU8Decoder,
getU8Encoder,
transformEncoder,
type Address,
type Codec,
type Decoder,
type Encoder,
type IAccountMeta,
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
type ReadonlyAccount,
} from '@solana/web3.js';
import { TOKEN_2022_PROGRAM_ADDRESS } from '../programs';
import { ResolvedAccount, getAccountMetaFactory } from '../shared';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export type AmountToUiAmountInstruction<
TProgram extends string = typeof TOKEN_2022_PROGRAM_ADDRESS,
Expand Down
28 changes: 14 additions & 14 deletions clients/js/src/generated/instructions/approve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,6 @@

import {
AccountRole,
Address,
Codec,
Decoder,
Encoder,
IAccountMeta,
IAccountSignerMeta,
IInstruction,
IInstructionWithAccounts,
IInstructionWithData,
ReadonlyAccount,
ReadonlySignerAccount,
TransactionSigner,
WritableAccount,
combineCodec,
getStructDecoder,
getStructEncoder,
Expand All @@ -29,9 +16,22 @@ import {
getU8Decoder,
getU8Encoder,
transformEncoder,
type Address,
type Codec,
type Decoder,
type Encoder,
type IAccountMeta,
type IAccountSignerMeta,
type IInstruction,
type IInstructionWithAccounts,
type IInstructionWithData,
type ReadonlyAccount,
type ReadonlySignerAccount,
type TransactionSigner,
type WritableAccount,
} from '@solana/web3.js';
import { TOKEN_2022_PROGRAM_ADDRESS } from '../programs';
import { ResolvedAccount, getAccountMetaFactory } from '../shared';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export type ApproveInstruction<
TProgram extends string = typeof TOKEN_2022_PROGRAM_ADDRESS,
Expand Down
Loading

0 comments on commit cbf5c38

Please sign in to comment.