Skip to content

Commit d9b3649

Browse files
authored
Use Codama v1.0.0 (#14)
1 parent eff3b5a commit d9b3649

File tree

25 files changed

+296
-325
lines changed

25 files changed

+296
-325
lines changed

clients/js/src/generated/accounts/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* This code was AUTOGENERATED using the kinobi library.
2+
* This code was AUTOGENERATED using the codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun kinobi to update it.
4+
* to add features, then rerun codama to update it.
55
*
6-
* @see https://github.com/kinobi-so/kinobi
6+
* @see https://github.com/codama-idl/codama
77
*/
88

99
import {
@@ -34,7 +34,7 @@ import {
3434
getConfigKeysEncoder,
3535
type ConfigKeys,
3636
type ConfigKeysArgs,
37-
} from '../../hooked';
37+
} from '../types';
3838

3939
export type Config = {
4040
/**
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* This code was AUTOGENERATED using the kinobi library.
2+
* This code was AUTOGENERATED using the codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun kinobi to update it.
4+
* to add features, then rerun codama to update it.
55
*
6-
* @see https://github.com/kinobi-so/kinobi
6+
* @see https://github.com/codama-idl/codama
77
*/
88

99
export * from './config';

clients/js/src/generated/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/**
2-
* This code was AUTOGENERATED using the kinobi library.
2+
* This code was AUTOGENERATED using the codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun kinobi to update it.
4+
* to add features, then rerun codama to update it.
55
*
6-
* @see https://github.com/kinobi-so/kinobi
6+
* @see https://github.com/codama-idl/codama
77
*/
88

99
export * from './accounts';
1010
export * from './instructions';
1111
export * from './programs';
12+
export * from './types';
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* This code was AUTOGENERATED using the kinobi library.
2+
* This code was AUTOGENERATED using the codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun kinobi to update it.
4+
* to add features, then rerun codama to update it.
55
*
6-
* @see https://github.com/kinobi-so/kinobi
6+
* @see https://github.com/codama-idl/codama
77
*/
88

99
export * from './store';

clients/js/src/generated/instructions/store.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* This code was AUTOGENERATED using the kinobi library.
2+
* This code was AUTOGENERATED using the codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun kinobi to update it.
4+
* to add features, then rerun codama to update it.
55
*
6-
* @see https://github.com/kinobi-so/kinobi
6+
* @see https://github.com/codama-idl/codama
77
*/
88

99
import {
@@ -27,14 +27,14 @@ import {
2727
type WritableAccount,
2828
type WritableSignerAccount,
2929
} from '@solana/web3.js';
30+
import { SOLANA_CONFIG_PROGRAM_ADDRESS } from '../programs';
31+
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
3032
import {
3133
getConfigKeysDecoder,
3234
getConfigKeysEncoder,
3335
type ConfigKeys,
3436
type ConfigKeysArgs,
35-
} from '../../hooked';
36-
import { SOLANA_CONFIG_PROGRAM_ADDRESS } from '../programs';
37-
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
37+
} from '../types';
3838

3939
export type StoreInstruction<
4040
TProgram extends string = typeof SOLANA_CONFIG_PROGRAM_ADDRESS,
@@ -111,17 +111,22 @@ export type StoreInput<TAccountConfigAccount extends string = string> = {
111111
signers?: Array<TransactionSigner>;
112112
};
113113

114-
export function getStoreInstruction<TAccountConfigAccount extends string>(
115-
input: StoreInput<TAccountConfigAccount>
114+
export function getStoreInstruction<
115+
TAccountConfigAccount extends string,
116+
TProgramAddress extends Address = typeof SOLANA_CONFIG_PROGRAM_ADDRESS,
117+
>(
118+
input: StoreInput<TAccountConfigAccount>,
119+
config?: { programAddress?: TProgramAddress }
116120
): StoreInstruction<
117-
typeof SOLANA_CONFIG_PROGRAM_ADDRESS,
121+
TProgramAddress,
118122
(typeof input)['configAccount'] extends TransactionSigner<TAccountConfigAccount>
119123
? WritableSignerAccount<TAccountConfigAccount> &
120124
IAccountSignerMeta<TAccountConfigAccount>
121125
: TAccountConfigAccount
122126
> {
123127
// Program address.
124-
const programAddress = SOLANA_CONFIG_PROGRAM_ADDRESS;
128+
const programAddress =
129+
config?.programAddress ?? SOLANA_CONFIG_PROGRAM_ADDRESS;
125130

126131
// Original accounts.
127132
const originalAccounts = {
@@ -152,7 +157,7 @@ export function getStoreInstruction<TAccountConfigAccount extends string>(
152157
args as StoreInstructionDataArgs
153158
),
154159
} as StoreInstruction<
155-
typeof SOLANA_CONFIG_PROGRAM_ADDRESS,
160+
TProgramAddress,
156161
(typeof input)['configAccount'] extends TransactionSigner<TAccountConfigAccount>
157162
? WritableSignerAccount<TAccountConfigAccount> &
158163
IAccountSignerMeta<TAccountConfigAccount>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* This code was AUTOGENERATED using the kinobi library.
2+
* This code was AUTOGENERATED using the codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun kinobi to update it.
4+
* to add features, then rerun codama to update it.
55
*
6-
* @see https://github.com/kinobi-so/kinobi
6+
* @see https://github.com/codama-idl/codama
77
*/
88

99
export * from './solanaConfig';

clients/js/src/generated/programs/solanaConfig.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* This code was AUTOGENERATED using the kinobi library.
2+
* This code was AUTOGENERATED using the codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun kinobi to update it.
4+
* to add features, then rerun codama to update it.
55
*
6-
* @see https://github.com/kinobi-so/kinobi
6+
* @see https://github.com/codama-idl/codama
77
*/
88

99
import { type Address } from '@solana/web3.js';

clients/js/src/generated/shared/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* This code was AUTOGENERATED using the kinobi library.
2+
* This code was AUTOGENERATED using the codama library.
33
* Please DO NOT EDIT THIS FILE, instead use visitors
4-
* to add features, then rerun kinobi to update it.
4+
* to add features, then rerun codama to update it.
55
*
6-
* @see https://github.com/kinobi-so/kinobi
6+
* @see https://github.com/codama-idl/codama
77
*/
88

99
import {
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* This code was AUTOGENERATED using the codama library.
3+
* Please DO NOT EDIT THIS FILE, instead use visitors
4+
* to add features, then rerun codama to update it.
5+
*
6+
* @see https://github.com/codama-idl/codama
7+
*/
8+
9+
import {
10+
combineCodec,
11+
getAddressDecoder,
12+
getAddressEncoder,
13+
getArrayDecoder,
14+
getArrayEncoder,
15+
getBooleanDecoder,
16+
getBooleanEncoder,
17+
getShortU16Decoder,
18+
getShortU16Encoder,
19+
getTupleDecoder,
20+
getTupleEncoder,
21+
type Address,
22+
type Codec,
23+
type Decoder,
24+
type Encoder,
25+
} from '@solana/web3.js';
26+
27+
/**
28+
* A collection of keys to be stored in Config account data.
29+
* Each key tuple comprises a unique `Pubkey` identifier,
30+
* and `bool` whether that key is a signer of the data.
31+
*/
32+
33+
export type ConfigKeys = Array<readonly [Address, boolean]>;
34+
35+
export type ConfigKeysArgs = ConfigKeys;
36+
37+
export function getConfigKeysEncoder(): Encoder<ConfigKeysArgs> {
38+
return getArrayEncoder(
39+
getTupleEncoder([getAddressEncoder(), getBooleanEncoder()]),
40+
{ size: getShortU16Encoder() }
41+
);
42+
}
43+
44+
export function getConfigKeysDecoder(): Decoder<ConfigKeys> {
45+
return getArrayDecoder(
46+
getTupleDecoder([getAddressDecoder(), getBooleanDecoder()]),
47+
{ size: getShortU16Decoder() }
48+
);
49+
}
50+
51+
export function getConfigKeysCodec(): Codec<ConfigKeysArgs, ConfigKeys> {
52+
return combineCodec(getConfigKeysEncoder(), getConfigKeysDecoder());
53+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* This code was AUTOGENERATED using the codama library.
3+
* Please DO NOT EDIT THIS FILE, instead use visitors
4+
* to add features, then rerun codama to update it.
5+
*
6+
* @see https://github.com/codama-idl/codama
7+
*/
8+
9+
export * from './configKeys';

0 commit comments

Comments
 (0)