Skip to content
Merged
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
8 changes: 4 additions & 4 deletions clients/js/src/generated/accounts/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

import {
Expand Down Expand Up @@ -34,7 +34,7 @@ import {
getConfigKeysEncoder,
type ConfigKeys,
type ConfigKeysArgs,
} from '../../hooked';
} from '../types';

export type Config = {
/**
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/accounts/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

export * from './config';
7 changes: 4 additions & 3 deletions clients/js/src/generated/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

export * from './accounts';
export * from './instructions';
export * from './programs';
export * from './types';
6 changes: 3 additions & 3 deletions clients/js/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

export * from './store';
27 changes: 16 additions & 11 deletions clients/js/src/generated/instructions/store.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

import {
Expand All @@ -27,14 +27,14 @@ import {
type WritableAccount,
type WritableSignerAccount,
} from '@solana/web3.js';
import { SOLANA_CONFIG_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
import {
getConfigKeysDecoder,
getConfigKeysEncoder,
type ConfigKeys,
type ConfigKeysArgs,
} from '../../hooked';
import { SOLANA_CONFIG_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
} from '../types';

export type StoreInstruction<
TProgram extends string = typeof SOLANA_CONFIG_PROGRAM_ADDRESS,
Expand Down Expand Up @@ -111,17 +111,22 @@ export type StoreInput<TAccountConfigAccount extends string = string> = {
signers?: Array<TransactionSigner>;
};

export function getStoreInstruction<TAccountConfigAccount extends string>(
input: StoreInput<TAccountConfigAccount>
export function getStoreInstruction<
TAccountConfigAccount extends string,
TProgramAddress extends Address = typeof SOLANA_CONFIG_PROGRAM_ADDRESS,
>(
input: StoreInput<TAccountConfigAccount>,
config?: { programAddress?: TProgramAddress }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, so one could use the config program client against a different config program (configurable program ID)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! This is a late addition from @mcintyre94 (See PR). For instance, this allows someone to use the SPL Token JS client for the Token 2022 program (if someone was taking bloody ages to release a Token 2022 client for example 👀).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dig it!!

): StoreInstruction<
typeof SOLANA_CONFIG_PROGRAM_ADDRESS,
TProgramAddress,
(typeof input)['configAccount'] extends TransactionSigner<TAccountConfigAccount>
? WritableSignerAccount<TAccountConfigAccount> &
IAccountSignerMeta<TAccountConfigAccount>
: TAccountConfigAccount
> {
// Program address.
const programAddress = SOLANA_CONFIG_PROGRAM_ADDRESS;
const programAddress =
config?.programAddress ?? SOLANA_CONFIG_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand Down Expand Up @@ -152,7 +157,7 @@ export function getStoreInstruction<TAccountConfigAccount extends string>(
args as StoreInstructionDataArgs
),
} as StoreInstruction<
typeof SOLANA_CONFIG_PROGRAM_ADDRESS,
TProgramAddress,
(typeof input)['configAccount'] extends TransactionSigner<TAccountConfigAccount>
? WritableSignerAccount<TAccountConfigAccount> &
IAccountSignerMeta<TAccountConfigAccount>
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/programs/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

export * from './solanaConfig';
6 changes: 3 additions & 3 deletions clients/js/src/generated/programs/solanaConfig.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

import { type Address } from '@solana/web3.js';
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/shared/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

import {
Expand Down
53 changes: 53 additions & 0 deletions clients/js/src/generated/types/configKeys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/

import {
combineCodec,
getAddressDecoder,
getAddressEncoder,
getArrayDecoder,
getArrayEncoder,
getBooleanDecoder,
getBooleanEncoder,
getShortU16Decoder,
getShortU16Encoder,
getTupleDecoder,
getTupleEncoder,
type Address,
type Codec,
type Decoder,
type Encoder,
} from '@solana/web3.js';

/**
* A collection of keys to be stored in Config account data.
* Each key tuple comprises a unique `Pubkey` identifier,
* and `bool` whether that key is a signer of the data.
*/

export type ConfigKeys = Array<readonly [Address, boolean]>;

export type ConfigKeysArgs = ConfigKeys;

export function getConfigKeysEncoder(): Encoder<ConfigKeysArgs> {
return getArrayEncoder(
getTupleEncoder([getAddressEncoder(), getBooleanEncoder()]),
{ size: getShortU16Encoder() }
);
}

export function getConfigKeysDecoder(): Decoder<ConfigKeys> {
return getArrayDecoder(
getTupleDecoder([getAddressDecoder(), getBooleanDecoder()]),
{ size: getShortU16Decoder() }
);
}

export function getConfigKeysCodec(): Codec<ConfigKeysArgs, ConfigKeys> {
return combineCodec(getConfigKeysEncoder(), getConfigKeysDecoder());
}
9 changes: 9 additions & 0 deletions clients/js/src/generated/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun codama to update it.
*
* @see https://github.com/codama-idl/codama
*/

export * from './configKeys';
1 change: 0 additions & 1 deletion clients/js/src/hooked/index.ts

This file was deleted.

68 changes: 0 additions & 68 deletions clients/js/src/hooked/shortVec.ts

This file was deleted.

1 change: 0 additions & 1 deletion clients/js/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './generated';
export * from './hooked';
2 changes: 1 addition & 1 deletion clients/js/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';

test('placeholder', async (t) => {
test('placeholder', (t) => {
t.true(true);
});
6 changes: 3 additions & 3 deletions clients/rust/src/generated/accounts/config.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>

use {
crate::hooked::ConfigKeys,
Expand Down
6 changes: 3 additions & 3 deletions clients/rust/src/generated/accounts/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>

pub(crate) mod r#config;

Expand Down
6 changes: 3 additions & 3 deletions clients/rust/src/generated/errors/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>
6 changes: 3 additions & 3 deletions clients/rust/src/generated/instructions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>

pub(crate) mod r#store;

Expand Down
8 changes: 4 additions & 4 deletions clients/rust/src/generated/instructions/store.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>

use {
crate::hooked::ConfigKeys,
Expand Down Expand Up @@ -110,7 +110,7 @@ impl StoreBuilder {
self.data = Some(data);
self
}
/// Add an aditional account to the instruction.
/// Add an additional account to the instruction.
#[inline(always)]
pub fn add_remaining_account(
&mut self,
Expand Down
6 changes: 3 additions & 3 deletions clients/rust/src/generated/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>

pub mod accounts;
pub mod errors;
Expand Down
Loading