@whetstone-research/doppler-sdk 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/evm/index.cjs +4 -3
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.js +4 -3
- package/dist/evm/index.js.map +1 -1
- package/dist/solana/index.cjs +999 -30
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +1002 -503
- package/dist/solana/index.d.ts +1002 -503
- package/dist/solana/index.js +1000 -32
- package/dist/solana/index.js.map +1 -1
- package/package.json +1 -1
package/dist/solana/index.cjs
CHANGED
|
@@ -3603,6 +3603,930 @@ async function fetchConfigWithAddress(rpc, programId = chunk3BW6IVP3_cjs.CPMM_PR
|
|
|
3603
3603
|
return { address: configAddress, account };
|
|
3604
3604
|
}
|
|
3605
3605
|
|
|
3606
|
+
// src/solana/cosignerHook/index.ts
|
|
3607
|
+
var cosignerHook_exports = {};
|
|
3608
|
+
chunkQ7SFCCGT_cjs.__export(cosignerHook_exports, {
|
|
3609
|
+
ADD_COSIGNER_DISCRIMINATOR: () => ADD_COSIGNER_DISCRIMINATOR,
|
|
3610
|
+
COSIGNER_CONFIG_DISCRIMINATOR: () => COSIGNER_CONFIG_DISCRIMINATOR,
|
|
3611
|
+
COSIGNER_HOOK_ERROR__COSIGNER_ALREADY_EXISTS: () => COSIGNER_HOOK_ERROR__COSIGNER_ALREADY_EXISTS,
|
|
3612
|
+
COSIGNER_HOOK_ERROR__COSIGNER_LIST_FULL: () => COSIGNER_HOOK_ERROR__COSIGNER_LIST_FULL,
|
|
3613
|
+
COSIGNER_HOOK_ERROR__COSIGNER_NOT_FOUND: () => COSIGNER_HOOK_ERROR__COSIGNER_NOT_FOUND,
|
|
3614
|
+
COSIGNER_HOOK_ERROR__INVALID_AUTHORITY: () => COSIGNER_HOOK_ERROR__INVALID_AUTHORITY,
|
|
3615
|
+
COSIGNER_HOOK_ERROR__INVALID_CONFIG: () => COSIGNER_HOOK_ERROR__INVALID_CONFIG,
|
|
3616
|
+
COSIGNER_HOOK_ERROR__INVALID_COSIGNER: () => COSIGNER_HOOK_ERROR__INVALID_COSIGNER,
|
|
3617
|
+
COSIGNER_HOOK_PROGRAM_ADDRESS: () => COSIGNER_HOOK_PROGRAM_ADDRESS,
|
|
3618
|
+
COSIGNER_HOOK_PROGRAM_ID: () => COSIGNER_HOOK_PROGRAM_ID,
|
|
3619
|
+
CosignerHookAccount: () => CosignerHookAccount,
|
|
3620
|
+
CosignerHookInstruction: () => CosignerHookInstruction,
|
|
3621
|
+
INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR2,
|
|
3622
|
+
MAX_COSIGNERS: () => MAX_COSIGNERS,
|
|
3623
|
+
REMOVE_COSIGNER_DISCRIMINATOR: () => REMOVE_COSIGNER_DISCRIMINATOR,
|
|
3624
|
+
SEED_COSIGNER_HOOK_CONFIG: () => SEED_COSIGNER_HOOK_CONFIG,
|
|
3625
|
+
SET_AUTHORITY_DISCRIMINATOR: () => SET_AUTHORITY_DISCRIMINATOR,
|
|
3626
|
+
cosignerHookProgram: () => cosignerHookProgram,
|
|
3627
|
+
decodeCosignerConfig: () => decodeCosignerConfig,
|
|
3628
|
+
fetchAllCosignerConfig: () => fetchAllCosignerConfig,
|
|
3629
|
+
fetchAllMaybeCosignerConfig: () => fetchAllMaybeCosignerConfig,
|
|
3630
|
+
fetchCosignerConfig: () => fetchCosignerConfig,
|
|
3631
|
+
fetchMaybeCosignerConfig: () => fetchMaybeCosignerConfig,
|
|
3632
|
+
getAddCosignerDiscriminatorBytes: () => getAddCosignerDiscriminatorBytes,
|
|
3633
|
+
getAddCosignerInstruction: () => getAddCosignerInstruction,
|
|
3634
|
+
getAddCosignerInstructionAsync: () => getAddCosignerInstructionAsync,
|
|
3635
|
+
getAddCosignerInstructionDataCodec: () => getAddCosignerInstructionDataCodec,
|
|
3636
|
+
getAddCosignerInstructionDataDecoder: () => getAddCosignerInstructionDataDecoder,
|
|
3637
|
+
getAddCosignerInstructionDataEncoder: () => getAddCosignerInstructionDataEncoder,
|
|
3638
|
+
getCosignerArgCodec: () => getCosignerArgCodec,
|
|
3639
|
+
getCosignerArgDecoder: () => getCosignerArgDecoder,
|
|
3640
|
+
getCosignerArgEncoder: () => getCosignerArgEncoder,
|
|
3641
|
+
getCosignerConfigCodec: () => getCosignerConfigCodec,
|
|
3642
|
+
getCosignerConfigDecoder: () => getCosignerConfigDecoder,
|
|
3643
|
+
getCosignerConfigDiscriminatorBytes: () => getCosignerConfigDiscriminatorBytes,
|
|
3644
|
+
getCosignerConfigEncoder: () => getCosignerConfigEncoder,
|
|
3645
|
+
getCosignerConfigSize: () => getCosignerConfigSize,
|
|
3646
|
+
getCosignerHookConfigAddress: () => getCosignerHookConfigAddress,
|
|
3647
|
+
getCosignerHookErrorMessage: () => getCosignerHookErrorMessage,
|
|
3648
|
+
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec,
|
|
3649
|
+
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder,
|
|
3650
|
+
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder,
|
|
3651
|
+
getInitializeConfigDiscriminatorBytes: () => getInitializeConfigDiscriminatorBytes2,
|
|
3652
|
+
getInitializeConfigInstruction: () => getInitializeConfigInstruction2,
|
|
3653
|
+
getInitializeConfigInstructionAsync: () => getInitializeConfigInstructionAsync2,
|
|
3654
|
+
getInitializeConfigInstructionDataCodec: () => getInitializeConfigInstructionDataCodec2,
|
|
3655
|
+
getInitializeConfigInstructionDataDecoder: () => getInitializeConfigInstructionDataDecoder2,
|
|
3656
|
+
getInitializeConfigInstructionDataEncoder: () => getInitializeConfigInstructionDataEncoder2,
|
|
3657
|
+
getRemoveCosignerDiscriminatorBytes: () => getRemoveCosignerDiscriminatorBytes,
|
|
3658
|
+
getRemoveCosignerInstruction: () => getRemoveCosignerInstruction,
|
|
3659
|
+
getRemoveCosignerInstructionAsync: () => getRemoveCosignerInstructionAsync,
|
|
3660
|
+
getRemoveCosignerInstructionDataCodec: () => getRemoveCosignerInstructionDataCodec,
|
|
3661
|
+
getRemoveCosignerInstructionDataDecoder: () => getRemoveCosignerInstructionDataDecoder,
|
|
3662
|
+
getRemoveCosignerInstructionDataEncoder: () => getRemoveCosignerInstructionDataEncoder,
|
|
3663
|
+
getSetAuthorityArgsCodec: () => getSetAuthorityArgsCodec,
|
|
3664
|
+
getSetAuthorityArgsDecoder: () => getSetAuthorityArgsDecoder,
|
|
3665
|
+
getSetAuthorityArgsEncoder: () => getSetAuthorityArgsEncoder,
|
|
3666
|
+
getSetAuthorityDiscriminatorBytes: () => getSetAuthorityDiscriminatorBytes,
|
|
3667
|
+
getSetAuthorityInstruction: () => getSetAuthorityInstruction,
|
|
3668
|
+
getSetAuthorityInstructionAsync: () => getSetAuthorityInstructionAsync,
|
|
3669
|
+
getSetAuthorityInstructionDataCodec: () => getSetAuthorityInstructionDataCodec,
|
|
3670
|
+
getSetAuthorityInstructionDataDecoder: () => getSetAuthorityInstructionDataDecoder,
|
|
3671
|
+
getSetAuthorityInstructionDataEncoder: () => getSetAuthorityInstructionDataEncoder,
|
|
3672
|
+
identifyCosignerHookAccount: () => identifyCosignerHookAccount,
|
|
3673
|
+
identifyCosignerHookInstruction: () => identifyCosignerHookInstruction,
|
|
3674
|
+
isCosignerHookError: () => isCosignerHookError,
|
|
3675
|
+
parseAddCosignerInstruction: () => parseAddCosignerInstruction,
|
|
3676
|
+
parseCosignerHookInstruction: () => parseCosignerHookInstruction,
|
|
3677
|
+
parseInitializeConfigInstruction: () => parseInitializeConfigInstruction2,
|
|
3678
|
+
parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction,
|
|
3679
|
+
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction
|
|
3680
|
+
});
|
|
3681
|
+
var COSIGNER_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
3682
|
+
133,
|
|
3683
|
+
227,
|
|
3684
|
+
177,
|
|
3685
|
+
74,
|
|
3686
|
+
145,
|
|
3687
|
+
74,
|
|
3688
|
+
247,
|
|
3689
|
+
183
|
|
3690
|
+
]);
|
|
3691
|
+
function getCosignerConfigDiscriminatorBytes() {
|
|
3692
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
3693
|
+
COSIGNER_CONFIG_DISCRIMINATOR
|
|
3694
|
+
);
|
|
3695
|
+
}
|
|
3696
|
+
function getCosignerConfigEncoder() {
|
|
3697
|
+
return kit.transformEncoder(
|
|
3698
|
+
kit.getStructEncoder([
|
|
3699
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
3700
|
+
["adminAuthority", kit.getAddressEncoder()],
|
|
3701
|
+
["cosignerCount", kit.getU8Encoder()],
|
|
3702
|
+
["bump", kit.getU8Encoder()],
|
|
3703
|
+
["version", kit.getU8Encoder()],
|
|
3704
|
+
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 37)],
|
|
3705
|
+
["cosigners", kit.getArrayEncoder(kit.getAddressEncoder(), { size: 32 })]
|
|
3706
|
+
]),
|
|
3707
|
+
(value) => ({ ...value, discriminator: COSIGNER_CONFIG_DISCRIMINATOR })
|
|
3708
|
+
);
|
|
3709
|
+
}
|
|
3710
|
+
function getCosignerConfigDecoder() {
|
|
3711
|
+
return kit.getStructDecoder([
|
|
3712
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
3713
|
+
["adminAuthority", kit.getAddressDecoder()],
|
|
3714
|
+
["cosignerCount", kit.getU8Decoder()],
|
|
3715
|
+
["bump", kit.getU8Decoder()],
|
|
3716
|
+
["version", kit.getU8Decoder()],
|
|
3717
|
+
["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 37)],
|
|
3718
|
+
["cosigners", kit.getArrayDecoder(kit.getAddressDecoder(), { size: 32 })]
|
|
3719
|
+
]);
|
|
3720
|
+
}
|
|
3721
|
+
function getCosignerConfigCodec() {
|
|
3722
|
+
return kit.combineCodec(getCosignerConfigEncoder(), getCosignerConfigDecoder());
|
|
3723
|
+
}
|
|
3724
|
+
function decodeCosignerConfig(encodedAccount) {
|
|
3725
|
+
return kit.decodeAccount(
|
|
3726
|
+
encodedAccount,
|
|
3727
|
+
getCosignerConfigDecoder()
|
|
3728
|
+
);
|
|
3729
|
+
}
|
|
3730
|
+
async function fetchCosignerConfig(rpc, address3, config) {
|
|
3731
|
+
const maybeAccount = await fetchMaybeCosignerConfig(rpc, address3, config);
|
|
3732
|
+
kit.assertAccountExists(maybeAccount);
|
|
3733
|
+
return maybeAccount;
|
|
3734
|
+
}
|
|
3735
|
+
async function fetchMaybeCosignerConfig(rpc, address3, config) {
|
|
3736
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address3, config);
|
|
3737
|
+
return decodeCosignerConfig(maybeAccount);
|
|
3738
|
+
}
|
|
3739
|
+
async function fetchAllCosignerConfig(rpc, addresses, config) {
|
|
3740
|
+
const maybeAccounts = await fetchAllMaybeCosignerConfig(
|
|
3741
|
+
rpc,
|
|
3742
|
+
addresses,
|
|
3743
|
+
config
|
|
3744
|
+
);
|
|
3745
|
+
kit.assertAccountsExist(maybeAccounts);
|
|
3746
|
+
return maybeAccounts;
|
|
3747
|
+
}
|
|
3748
|
+
async function fetchAllMaybeCosignerConfig(rpc, addresses, config) {
|
|
3749
|
+
const maybeAccounts = await kit.fetchEncodedAccounts(rpc, addresses, config);
|
|
3750
|
+
return maybeAccounts.map(
|
|
3751
|
+
(maybeAccount) => decodeCosignerConfig(maybeAccount)
|
|
3752
|
+
);
|
|
3753
|
+
}
|
|
3754
|
+
function getCosignerConfigSize() {
|
|
3755
|
+
return 1104;
|
|
3756
|
+
}
|
|
3757
|
+
var ADD_COSIGNER_DISCRIMINATOR = new Uint8Array([
|
|
3758
|
+
17,
|
|
3759
|
+
34,
|
|
3760
|
+
183,
|
|
3761
|
+
119,
|
|
3762
|
+
202,
|
|
3763
|
+
255,
|
|
3764
|
+
218,
|
|
3765
|
+
233
|
|
3766
|
+
]);
|
|
3767
|
+
function getAddCosignerDiscriminatorBytes() {
|
|
3768
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
3769
|
+
ADD_COSIGNER_DISCRIMINATOR
|
|
3770
|
+
);
|
|
3771
|
+
}
|
|
3772
|
+
function getAddCosignerInstructionDataEncoder() {
|
|
3773
|
+
return kit.transformEncoder(
|
|
3774
|
+
kit.getStructEncoder([
|
|
3775
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
3776
|
+
["cosigner", kit.getAddressEncoder()]
|
|
3777
|
+
]),
|
|
3778
|
+
(value) => ({ ...value, discriminator: ADD_COSIGNER_DISCRIMINATOR })
|
|
3779
|
+
);
|
|
3780
|
+
}
|
|
3781
|
+
function getAddCosignerInstructionDataDecoder() {
|
|
3782
|
+
return kit.getStructDecoder([
|
|
3783
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
3784
|
+
["cosigner", kit.getAddressDecoder()]
|
|
3785
|
+
]);
|
|
3786
|
+
}
|
|
3787
|
+
function getAddCosignerInstructionDataCodec() {
|
|
3788
|
+
return kit.combineCodec(
|
|
3789
|
+
getAddCosignerInstructionDataEncoder(),
|
|
3790
|
+
getAddCosignerInstructionDataDecoder()
|
|
3791
|
+
);
|
|
3792
|
+
}
|
|
3793
|
+
async function getAddCosignerInstructionAsync(input, config) {
|
|
3794
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
3795
|
+
const originalAccounts = {
|
|
3796
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
3797
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
3798
|
+
};
|
|
3799
|
+
const accounts = originalAccounts;
|
|
3800
|
+
const args = { ...input };
|
|
3801
|
+
if (!accounts.config.value) {
|
|
3802
|
+
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
3803
|
+
programAddress,
|
|
3804
|
+
seeds: [
|
|
3805
|
+
kit.getBytesEncoder().encode(
|
|
3806
|
+
new Uint8Array([
|
|
3807
|
+
99,
|
|
3808
|
+
111,
|
|
3809
|
+
115,
|
|
3810
|
+
105,
|
|
3811
|
+
103,
|
|
3812
|
+
110,
|
|
3813
|
+
101,
|
|
3814
|
+
114,
|
|
3815
|
+
95,
|
|
3816
|
+
104,
|
|
3817
|
+
111,
|
|
3818
|
+
111,
|
|
3819
|
+
107,
|
|
3820
|
+
95,
|
|
3821
|
+
99,
|
|
3822
|
+
111,
|
|
3823
|
+
110,
|
|
3824
|
+
102,
|
|
3825
|
+
105,
|
|
3826
|
+
103
|
|
3827
|
+
])
|
|
3828
|
+
)
|
|
3829
|
+
]
|
|
3830
|
+
});
|
|
3831
|
+
}
|
|
3832
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3833
|
+
return Object.freeze({
|
|
3834
|
+
accounts: [
|
|
3835
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
3836
|
+
getAccountMeta("config", accounts.config)
|
|
3837
|
+
],
|
|
3838
|
+
data: getAddCosignerInstructionDataEncoder().encode(
|
|
3839
|
+
args
|
|
3840
|
+
),
|
|
3841
|
+
programAddress
|
|
3842
|
+
});
|
|
3843
|
+
}
|
|
3844
|
+
function getAddCosignerInstruction(input, config) {
|
|
3845
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
3846
|
+
const originalAccounts = {
|
|
3847
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
3848
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
3849
|
+
};
|
|
3850
|
+
const accounts = originalAccounts;
|
|
3851
|
+
const args = { ...input };
|
|
3852
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3853
|
+
return Object.freeze({
|
|
3854
|
+
accounts: [
|
|
3855
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
3856
|
+
getAccountMeta("config", accounts.config)
|
|
3857
|
+
],
|
|
3858
|
+
data: getAddCosignerInstructionDataEncoder().encode(
|
|
3859
|
+
args
|
|
3860
|
+
),
|
|
3861
|
+
programAddress
|
|
3862
|
+
});
|
|
3863
|
+
}
|
|
3864
|
+
function parseAddCosignerInstruction(instruction) {
|
|
3865
|
+
if (instruction.accounts.length < 2) {
|
|
3866
|
+
throw new kit.SolanaError(
|
|
3867
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3868
|
+
{
|
|
3869
|
+
actualAccountMetas: instruction.accounts.length,
|
|
3870
|
+
expectedAccountMetas: 2
|
|
3871
|
+
}
|
|
3872
|
+
);
|
|
3873
|
+
}
|
|
3874
|
+
let accountIndex = 0;
|
|
3875
|
+
const getNextAccount = () => {
|
|
3876
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
3877
|
+
accountIndex += 1;
|
|
3878
|
+
return accountMeta;
|
|
3879
|
+
};
|
|
3880
|
+
return {
|
|
3881
|
+
programAddress: instruction.programAddress,
|
|
3882
|
+
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
3883
|
+
data: getAddCosignerInstructionDataDecoder().decode(instruction.data)
|
|
3884
|
+
};
|
|
3885
|
+
}
|
|
3886
|
+
var INITIALIZE_CONFIG_DISCRIMINATOR2 = new Uint8Array([
|
|
3887
|
+
208,
|
|
3888
|
+
127,
|
|
3889
|
+
21,
|
|
3890
|
+
1,
|
|
3891
|
+
194,
|
|
3892
|
+
190,
|
|
3893
|
+
196,
|
|
3894
|
+
70
|
|
3895
|
+
]);
|
|
3896
|
+
function getInitializeConfigDiscriminatorBytes2() {
|
|
3897
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
3898
|
+
INITIALIZE_CONFIG_DISCRIMINATOR2
|
|
3899
|
+
);
|
|
3900
|
+
}
|
|
3901
|
+
function getInitializeConfigInstructionDataEncoder2() {
|
|
3902
|
+
return kit.transformEncoder(
|
|
3903
|
+
kit.getStructEncoder([
|
|
3904
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
3905
|
+
["cosigners", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
3906
|
+
]),
|
|
3907
|
+
(value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR2 })
|
|
3908
|
+
);
|
|
3909
|
+
}
|
|
3910
|
+
function getInitializeConfigInstructionDataDecoder2() {
|
|
3911
|
+
return kit.getStructDecoder([
|
|
3912
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
3913
|
+
["cosigners", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
3914
|
+
]);
|
|
3915
|
+
}
|
|
3916
|
+
function getInitializeConfigInstructionDataCodec2() {
|
|
3917
|
+
return kit.combineCodec(
|
|
3918
|
+
getInitializeConfigInstructionDataEncoder2(),
|
|
3919
|
+
getInitializeConfigInstructionDataDecoder2()
|
|
3920
|
+
);
|
|
3921
|
+
}
|
|
3922
|
+
async function getInitializeConfigInstructionAsync2(input, config) {
|
|
3923
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
3924
|
+
const originalAccounts = {
|
|
3925
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
3926
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
3927
|
+
config: { value: input.config ?? null, isWritable: true },
|
|
3928
|
+
programData: { value: input.programData ?? null, isWritable: false },
|
|
3929
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
3930
|
+
};
|
|
3931
|
+
const accounts = originalAccounts;
|
|
3932
|
+
const args = { ...input };
|
|
3933
|
+
if (!accounts.config.value) {
|
|
3934
|
+
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
3935
|
+
programAddress,
|
|
3936
|
+
seeds: [
|
|
3937
|
+
kit.getBytesEncoder().encode(
|
|
3938
|
+
new Uint8Array([
|
|
3939
|
+
99,
|
|
3940
|
+
111,
|
|
3941
|
+
115,
|
|
3942
|
+
105,
|
|
3943
|
+
103,
|
|
3944
|
+
110,
|
|
3945
|
+
101,
|
|
3946
|
+
114,
|
|
3947
|
+
95,
|
|
3948
|
+
104,
|
|
3949
|
+
111,
|
|
3950
|
+
111,
|
|
3951
|
+
107,
|
|
3952
|
+
95,
|
|
3953
|
+
99,
|
|
3954
|
+
111,
|
|
3955
|
+
110,
|
|
3956
|
+
102,
|
|
3957
|
+
105,
|
|
3958
|
+
103
|
|
3959
|
+
])
|
|
3960
|
+
)
|
|
3961
|
+
]
|
|
3962
|
+
});
|
|
3963
|
+
}
|
|
3964
|
+
if (!accounts.systemProgram.value) {
|
|
3965
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
3966
|
+
}
|
|
3967
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3968
|
+
return Object.freeze({
|
|
3969
|
+
accounts: [
|
|
3970
|
+
getAccountMeta("payer", accounts.payer),
|
|
3971
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
3972
|
+
getAccountMeta("config", accounts.config),
|
|
3973
|
+
getAccountMeta("programData", accounts.programData),
|
|
3974
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
3975
|
+
],
|
|
3976
|
+
data: getInitializeConfigInstructionDataEncoder2().encode(
|
|
3977
|
+
args
|
|
3978
|
+
),
|
|
3979
|
+
programAddress
|
|
3980
|
+
});
|
|
3981
|
+
}
|
|
3982
|
+
function getInitializeConfigInstruction2(input, config) {
|
|
3983
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
3984
|
+
const originalAccounts = {
|
|
3985
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
3986
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
3987
|
+
config: { value: input.config ?? null, isWritable: true },
|
|
3988
|
+
programData: { value: input.programData ?? null, isWritable: false },
|
|
3989
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
3990
|
+
};
|
|
3991
|
+
const accounts = originalAccounts;
|
|
3992
|
+
const args = { ...input };
|
|
3993
|
+
if (!accounts.systemProgram.value) {
|
|
3994
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
3995
|
+
}
|
|
3996
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3997
|
+
return Object.freeze({
|
|
3998
|
+
accounts: [
|
|
3999
|
+
getAccountMeta("payer", accounts.payer),
|
|
4000
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
4001
|
+
getAccountMeta("config", accounts.config),
|
|
4002
|
+
getAccountMeta("programData", accounts.programData),
|
|
4003
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
4004
|
+
],
|
|
4005
|
+
data: getInitializeConfigInstructionDataEncoder2().encode(
|
|
4006
|
+
args
|
|
4007
|
+
),
|
|
4008
|
+
programAddress
|
|
4009
|
+
});
|
|
4010
|
+
}
|
|
4011
|
+
function parseInitializeConfigInstruction2(instruction) {
|
|
4012
|
+
if (instruction.accounts.length < 5) {
|
|
4013
|
+
throw new kit.SolanaError(
|
|
4014
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
4015
|
+
{
|
|
4016
|
+
actualAccountMetas: instruction.accounts.length,
|
|
4017
|
+
expectedAccountMetas: 5
|
|
4018
|
+
}
|
|
4019
|
+
);
|
|
4020
|
+
}
|
|
4021
|
+
let accountIndex = 0;
|
|
4022
|
+
const getNextAccount = () => {
|
|
4023
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
4024
|
+
accountIndex += 1;
|
|
4025
|
+
return accountMeta;
|
|
4026
|
+
};
|
|
4027
|
+
return {
|
|
4028
|
+
programAddress: instruction.programAddress,
|
|
4029
|
+
accounts: {
|
|
4030
|
+
payer: getNextAccount(),
|
|
4031
|
+
adminAuthority: getNextAccount(),
|
|
4032
|
+
config: getNextAccount(),
|
|
4033
|
+
programData: getNextAccount(),
|
|
4034
|
+
systemProgram: getNextAccount()
|
|
4035
|
+
},
|
|
4036
|
+
data: getInitializeConfigInstructionDataDecoder2().decode(instruction.data)
|
|
4037
|
+
};
|
|
4038
|
+
}
|
|
4039
|
+
var REMOVE_COSIGNER_DISCRIMINATOR = new Uint8Array([
|
|
4040
|
+
174,
|
|
4041
|
+
11,
|
|
4042
|
+
171,
|
|
4043
|
+
252,
|
|
4044
|
+
179,
|
|
4045
|
+
99,
|
|
4046
|
+
220,
|
|
4047
|
+
27
|
|
4048
|
+
]);
|
|
4049
|
+
function getRemoveCosignerDiscriminatorBytes() {
|
|
4050
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
4051
|
+
REMOVE_COSIGNER_DISCRIMINATOR
|
|
4052
|
+
);
|
|
4053
|
+
}
|
|
4054
|
+
function getRemoveCosignerInstructionDataEncoder() {
|
|
4055
|
+
return kit.transformEncoder(
|
|
4056
|
+
kit.getStructEncoder([
|
|
4057
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
4058
|
+
["cosigner", kit.getAddressEncoder()]
|
|
4059
|
+
]),
|
|
4060
|
+
(value) => ({ ...value, discriminator: REMOVE_COSIGNER_DISCRIMINATOR })
|
|
4061
|
+
);
|
|
4062
|
+
}
|
|
4063
|
+
function getRemoveCosignerInstructionDataDecoder() {
|
|
4064
|
+
return kit.getStructDecoder([
|
|
4065
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
4066
|
+
["cosigner", kit.getAddressDecoder()]
|
|
4067
|
+
]);
|
|
4068
|
+
}
|
|
4069
|
+
function getRemoveCosignerInstructionDataCodec() {
|
|
4070
|
+
return kit.combineCodec(
|
|
4071
|
+
getRemoveCosignerInstructionDataEncoder(),
|
|
4072
|
+
getRemoveCosignerInstructionDataDecoder()
|
|
4073
|
+
);
|
|
4074
|
+
}
|
|
4075
|
+
async function getRemoveCosignerInstructionAsync(input, config) {
|
|
4076
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
4077
|
+
const originalAccounts = {
|
|
4078
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
4079
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
4080
|
+
};
|
|
4081
|
+
const accounts = originalAccounts;
|
|
4082
|
+
const args = { ...input };
|
|
4083
|
+
if (!accounts.config.value) {
|
|
4084
|
+
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
4085
|
+
programAddress,
|
|
4086
|
+
seeds: [
|
|
4087
|
+
kit.getBytesEncoder().encode(
|
|
4088
|
+
new Uint8Array([
|
|
4089
|
+
99,
|
|
4090
|
+
111,
|
|
4091
|
+
115,
|
|
4092
|
+
105,
|
|
4093
|
+
103,
|
|
4094
|
+
110,
|
|
4095
|
+
101,
|
|
4096
|
+
114,
|
|
4097
|
+
95,
|
|
4098
|
+
104,
|
|
4099
|
+
111,
|
|
4100
|
+
111,
|
|
4101
|
+
107,
|
|
4102
|
+
95,
|
|
4103
|
+
99,
|
|
4104
|
+
111,
|
|
4105
|
+
110,
|
|
4106
|
+
102,
|
|
4107
|
+
105,
|
|
4108
|
+
103
|
|
4109
|
+
])
|
|
4110
|
+
)
|
|
4111
|
+
]
|
|
4112
|
+
});
|
|
4113
|
+
}
|
|
4114
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
4115
|
+
return Object.freeze({
|
|
4116
|
+
accounts: [
|
|
4117
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
4118
|
+
getAccountMeta("config", accounts.config)
|
|
4119
|
+
],
|
|
4120
|
+
data: getRemoveCosignerInstructionDataEncoder().encode(
|
|
4121
|
+
args
|
|
4122
|
+
),
|
|
4123
|
+
programAddress
|
|
4124
|
+
});
|
|
4125
|
+
}
|
|
4126
|
+
function getRemoveCosignerInstruction(input, config) {
|
|
4127
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
4128
|
+
const originalAccounts = {
|
|
4129
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
4130
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
4131
|
+
};
|
|
4132
|
+
const accounts = originalAccounts;
|
|
4133
|
+
const args = { ...input };
|
|
4134
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
4135
|
+
return Object.freeze({
|
|
4136
|
+
accounts: [
|
|
4137
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
4138
|
+
getAccountMeta("config", accounts.config)
|
|
4139
|
+
],
|
|
4140
|
+
data: getRemoveCosignerInstructionDataEncoder().encode(
|
|
4141
|
+
args
|
|
4142
|
+
),
|
|
4143
|
+
programAddress
|
|
4144
|
+
});
|
|
4145
|
+
}
|
|
4146
|
+
function parseRemoveCosignerInstruction(instruction) {
|
|
4147
|
+
if (instruction.accounts.length < 2) {
|
|
4148
|
+
throw new kit.SolanaError(
|
|
4149
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
4150
|
+
{
|
|
4151
|
+
actualAccountMetas: instruction.accounts.length,
|
|
4152
|
+
expectedAccountMetas: 2
|
|
4153
|
+
}
|
|
4154
|
+
);
|
|
4155
|
+
}
|
|
4156
|
+
let accountIndex = 0;
|
|
4157
|
+
const getNextAccount = () => {
|
|
4158
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
4159
|
+
accountIndex += 1;
|
|
4160
|
+
return accountMeta;
|
|
4161
|
+
};
|
|
4162
|
+
return {
|
|
4163
|
+
programAddress: instruction.programAddress,
|
|
4164
|
+
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
4165
|
+
data: getRemoveCosignerInstructionDataDecoder().decode(instruction.data)
|
|
4166
|
+
};
|
|
4167
|
+
}
|
|
4168
|
+
var SET_AUTHORITY_DISCRIMINATOR = new Uint8Array([
|
|
4169
|
+
133,
|
|
4170
|
+
250,
|
|
4171
|
+
37,
|
|
4172
|
+
21,
|
|
4173
|
+
110,
|
|
4174
|
+
163,
|
|
4175
|
+
26,
|
|
4176
|
+
121
|
|
4177
|
+
]);
|
|
4178
|
+
function getSetAuthorityDiscriminatorBytes() {
|
|
4179
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
4180
|
+
SET_AUTHORITY_DISCRIMINATOR
|
|
4181
|
+
);
|
|
4182
|
+
}
|
|
4183
|
+
function getSetAuthorityInstructionDataEncoder() {
|
|
4184
|
+
return kit.transformEncoder(
|
|
4185
|
+
kit.getStructEncoder([
|
|
4186
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
4187
|
+
["adminAuthority", kit.getAddressEncoder()]
|
|
4188
|
+
]),
|
|
4189
|
+
(value) => ({ ...value, discriminator: SET_AUTHORITY_DISCRIMINATOR })
|
|
4190
|
+
);
|
|
4191
|
+
}
|
|
4192
|
+
function getSetAuthorityInstructionDataDecoder() {
|
|
4193
|
+
return kit.getStructDecoder([
|
|
4194
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
4195
|
+
["adminAuthority", kit.getAddressDecoder()]
|
|
4196
|
+
]);
|
|
4197
|
+
}
|
|
4198
|
+
function getSetAuthorityInstructionDataCodec() {
|
|
4199
|
+
return kit.combineCodec(
|
|
4200
|
+
getSetAuthorityInstructionDataEncoder(),
|
|
4201
|
+
getSetAuthorityInstructionDataDecoder()
|
|
4202
|
+
);
|
|
4203
|
+
}
|
|
4204
|
+
async function getSetAuthorityInstructionAsync(input, config) {
|
|
4205
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
4206
|
+
const originalAccounts = {
|
|
4207
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
4208
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
4209
|
+
};
|
|
4210
|
+
const accounts = originalAccounts;
|
|
4211
|
+
const args = { ...input, adminAuthority: input.adminAuthorityArg };
|
|
4212
|
+
if (!accounts.config.value) {
|
|
4213
|
+
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
4214
|
+
programAddress,
|
|
4215
|
+
seeds: [
|
|
4216
|
+
kit.getBytesEncoder().encode(
|
|
4217
|
+
new Uint8Array([
|
|
4218
|
+
99,
|
|
4219
|
+
111,
|
|
4220
|
+
115,
|
|
4221
|
+
105,
|
|
4222
|
+
103,
|
|
4223
|
+
110,
|
|
4224
|
+
101,
|
|
4225
|
+
114,
|
|
4226
|
+
95,
|
|
4227
|
+
104,
|
|
4228
|
+
111,
|
|
4229
|
+
111,
|
|
4230
|
+
107,
|
|
4231
|
+
95,
|
|
4232
|
+
99,
|
|
4233
|
+
111,
|
|
4234
|
+
110,
|
|
4235
|
+
102,
|
|
4236
|
+
105,
|
|
4237
|
+
103
|
|
4238
|
+
])
|
|
4239
|
+
)
|
|
4240
|
+
]
|
|
4241
|
+
});
|
|
4242
|
+
}
|
|
4243
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
4244
|
+
return Object.freeze({
|
|
4245
|
+
accounts: [
|
|
4246
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
4247
|
+
getAccountMeta("config", accounts.config)
|
|
4248
|
+
],
|
|
4249
|
+
data: getSetAuthorityInstructionDataEncoder().encode(
|
|
4250
|
+
args
|
|
4251
|
+
),
|
|
4252
|
+
programAddress
|
|
4253
|
+
});
|
|
4254
|
+
}
|
|
4255
|
+
function getSetAuthorityInstruction(input, config) {
|
|
4256
|
+
const programAddress = config?.programAddress ?? COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
4257
|
+
const originalAccounts = {
|
|
4258
|
+
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
4259
|
+
config: { value: input.config ?? null, isWritable: true }
|
|
4260
|
+
};
|
|
4261
|
+
const accounts = originalAccounts;
|
|
4262
|
+
const args = { ...input, adminAuthority: input.adminAuthorityArg };
|
|
4263
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
4264
|
+
return Object.freeze({
|
|
4265
|
+
accounts: [
|
|
4266
|
+
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
4267
|
+
getAccountMeta("config", accounts.config)
|
|
4268
|
+
],
|
|
4269
|
+
data: getSetAuthorityInstructionDataEncoder().encode(
|
|
4270
|
+
args
|
|
4271
|
+
),
|
|
4272
|
+
programAddress
|
|
4273
|
+
});
|
|
4274
|
+
}
|
|
4275
|
+
function parseSetAuthorityInstruction(instruction) {
|
|
4276
|
+
if (instruction.accounts.length < 2) {
|
|
4277
|
+
throw new kit.SolanaError(
|
|
4278
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
4279
|
+
{
|
|
4280
|
+
actualAccountMetas: instruction.accounts.length,
|
|
4281
|
+
expectedAccountMetas: 2
|
|
4282
|
+
}
|
|
4283
|
+
);
|
|
4284
|
+
}
|
|
4285
|
+
let accountIndex = 0;
|
|
4286
|
+
const getNextAccount = () => {
|
|
4287
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
4288
|
+
accountIndex += 1;
|
|
4289
|
+
return accountMeta;
|
|
4290
|
+
};
|
|
4291
|
+
return {
|
|
4292
|
+
programAddress: instruction.programAddress,
|
|
4293
|
+
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
4294
|
+
data: getSetAuthorityInstructionDataDecoder().decode(instruction.data)
|
|
4295
|
+
};
|
|
4296
|
+
}
|
|
4297
|
+
|
|
4298
|
+
// src/solana/generated/cosignerHook/programs/cosignerHook.ts
|
|
4299
|
+
var COSIGNER_HOOK_PROGRAM_ADDRESS = "JDwnBoYE2NsmkQjQLHi1btQxeHirtJ9XjU1dM641QZt";
|
|
4300
|
+
var CosignerHookAccount = /* @__PURE__ */ ((CosignerHookAccount2) => {
|
|
4301
|
+
CosignerHookAccount2[CosignerHookAccount2["CosignerConfig"] = 0] = "CosignerConfig";
|
|
4302
|
+
return CosignerHookAccount2;
|
|
4303
|
+
})(CosignerHookAccount || {});
|
|
4304
|
+
function identifyCosignerHookAccount(account) {
|
|
4305
|
+
const data = "data" in account ? account.data : account;
|
|
4306
|
+
if (kit.containsBytes(
|
|
4307
|
+
data,
|
|
4308
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
4309
|
+
new Uint8Array([133, 227, 177, 74, 145, 74, 247, 183])
|
|
4310
|
+
),
|
|
4311
|
+
0
|
|
4312
|
+
)) {
|
|
4313
|
+
return 0 /* CosignerConfig */;
|
|
4314
|
+
}
|
|
4315
|
+
throw new kit.SolanaError(
|
|
4316
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
|
|
4317
|
+
{ accountData: data, programName: "cosignerHook" }
|
|
4318
|
+
);
|
|
4319
|
+
}
|
|
4320
|
+
var CosignerHookInstruction = /* @__PURE__ */ ((CosignerHookInstruction2) => {
|
|
4321
|
+
CosignerHookInstruction2[CosignerHookInstruction2["AddCosigner"] = 0] = "AddCosigner";
|
|
4322
|
+
CosignerHookInstruction2[CosignerHookInstruction2["InitializeConfig"] = 1] = "InitializeConfig";
|
|
4323
|
+
CosignerHookInstruction2[CosignerHookInstruction2["RemoveCosigner"] = 2] = "RemoveCosigner";
|
|
4324
|
+
CosignerHookInstruction2[CosignerHookInstruction2["SetAuthority"] = 3] = "SetAuthority";
|
|
4325
|
+
return CosignerHookInstruction2;
|
|
4326
|
+
})(CosignerHookInstruction || {});
|
|
4327
|
+
function identifyCosignerHookInstruction(instruction) {
|
|
4328
|
+
const data = "data" in instruction ? instruction.data : instruction;
|
|
4329
|
+
if (kit.containsBytes(
|
|
4330
|
+
data,
|
|
4331
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
4332
|
+
new Uint8Array([17, 34, 183, 119, 202, 255, 218, 233])
|
|
4333
|
+
),
|
|
4334
|
+
0
|
|
4335
|
+
)) {
|
|
4336
|
+
return 0 /* AddCosigner */;
|
|
4337
|
+
}
|
|
4338
|
+
if (kit.containsBytes(
|
|
4339
|
+
data,
|
|
4340
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
4341
|
+
new Uint8Array([208, 127, 21, 1, 194, 190, 196, 70])
|
|
4342
|
+
),
|
|
4343
|
+
0
|
|
4344
|
+
)) {
|
|
4345
|
+
return 1 /* InitializeConfig */;
|
|
4346
|
+
}
|
|
4347
|
+
if (kit.containsBytes(
|
|
4348
|
+
data,
|
|
4349
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
4350
|
+
new Uint8Array([174, 11, 171, 252, 179, 99, 220, 27])
|
|
4351
|
+
),
|
|
4352
|
+
0
|
|
4353
|
+
)) {
|
|
4354
|
+
return 2 /* RemoveCosigner */;
|
|
4355
|
+
}
|
|
4356
|
+
if (kit.containsBytes(
|
|
4357
|
+
data,
|
|
4358
|
+
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
4359
|
+
new Uint8Array([133, 250, 37, 21, 110, 163, 26, 121])
|
|
4360
|
+
),
|
|
4361
|
+
0
|
|
4362
|
+
)) {
|
|
4363
|
+
return 3 /* SetAuthority */;
|
|
4364
|
+
}
|
|
4365
|
+
throw new kit.SolanaError(
|
|
4366
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
4367
|
+
{ instructionData: data, programName: "cosignerHook" }
|
|
4368
|
+
);
|
|
4369
|
+
}
|
|
4370
|
+
function parseCosignerHookInstruction(instruction) {
|
|
4371
|
+
const instructionType = identifyCosignerHookInstruction(instruction);
|
|
4372
|
+
switch (instructionType) {
|
|
4373
|
+
case 0 /* AddCosigner */: {
|
|
4374
|
+
kit.assertIsInstructionWithAccounts(instruction);
|
|
4375
|
+
return {
|
|
4376
|
+
instructionType: 0 /* AddCosigner */,
|
|
4377
|
+
...parseAddCosignerInstruction(instruction)
|
|
4378
|
+
};
|
|
4379
|
+
}
|
|
4380
|
+
case 1 /* InitializeConfig */: {
|
|
4381
|
+
kit.assertIsInstructionWithAccounts(instruction);
|
|
4382
|
+
return {
|
|
4383
|
+
instructionType: 1 /* InitializeConfig */,
|
|
4384
|
+
...parseInitializeConfigInstruction2(instruction)
|
|
4385
|
+
};
|
|
4386
|
+
}
|
|
4387
|
+
case 2 /* RemoveCosigner */: {
|
|
4388
|
+
kit.assertIsInstructionWithAccounts(instruction);
|
|
4389
|
+
return {
|
|
4390
|
+
instructionType: 2 /* RemoveCosigner */,
|
|
4391
|
+
...parseRemoveCosignerInstruction(instruction)
|
|
4392
|
+
};
|
|
4393
|
+
}
|
|
4394
|
+
case 3 /* SetAuthority */: {
|
|
4395
|
+
kit.assertIsInstructionWithAccounts(instruction);
|
|
4396
|
+
return {
|
|
4397
|
+
instructionType: 3 /* SetAuthority */,
|
|
4398
|
+
...parseSetAuthorityInstruction(instruction)
|
|
4399
|
+
};
|
|
4400
|
+
}
|
|
4401
|
+
default:
|
|
4402
|
+
throw new kit.SolanaError(
|
|
4403
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
4404
|
+
{
|
|
4405
|
+
instructionType,
|
|
4406
|
+
programName: "cosignerHook"
|
|
4407
|
+
}
|
|
4408
|
+
);
|
|
4409
|
+
}
|
|
4410
|
+
}
|
|
4411
|
+
function cosignerHookProgram() {
|
|
4412
|
+
return (client) => {
|
|
4413
|
+
return {
|
|
4414
|
+
...client,
|
|
4415
|
+
cosignerHook: {
|
|
4416
|
+
accounts: {
|
|
4417
|
+
cosignerConfig: programClientCore.addSelfFetchFunctions(
|
|
4418
|
+
client,
|
|
4419
|
+
getCosignerConfigCodec()
|
|
4420
|
+
)
|
|
4421
|
+
},
|
|
4422
|
+
instructions: {
|
|
4423
|
+
addCosigner: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
4424
|
+
client,
|
|
4425
|
+
getAddCosignerInstructionAsync(input)
|
|
4426
|
+
),
|
|
4427
|
+
initializeConfig: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
4428
|
+
client,
|
|
4429
|
+
getInitializeConfigInstructionAsync2({
|
|
4430
|
+
...input,
|
|
4431
|
+
payer: input.payer ?? client.payer
|
|
4432
|
+
})
|
|
4433
|
+
),
|
|
4434
|
+
removeCosigner: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
4435
|
+
client,
|
|
4436
|
+
getRemoveCosignerInstructionAsync(input)
|
|
4437
|
+
),
|
|
4438
|
+
setAuthority: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
4439
|
+
client,
|
|
4440
|
+
getSetAuthorityInstructionAsync(input)
|
|
4441
|
+
)
|
|
4442
|
+
}
|
|
4443
|
+
}
|
|
4444
|
+
};
|
|
4445
|
+
};
|
|
4446
|
+
}
|
|
4447
|
+
|
|
4448
|
+
// src/solana/generated/cosignerHook/errors/cosignerHook.ts
|
|
4449
|
+
var COSIGNER_HOOK_ERROR__INVALID_CONFIG = 6e3;
|
|
4450
|
+
var COSIGNER_HOOK_ERROR__INVALID_AUTHORITY = 6001;
|
|
4451
|
+
var COSIGNER_HOOK_ERROR__INVALID_COSIGNER = 6002;
|
|
4452
|
+
var COSIGNER_HOOK_ERROR__COSIGNER_ALREADY_EXISTS = 6003;
|
|
4453
|
+
var COSIGNER_HOOK_ERROR__COSIGNER_NOT_FOUND = 6004;
|
|
4454
|
+
var COSIGNER_HOOK_ERROR__COSIGNER_LIST_FULL = 6005;
|
|
4455
|
+
var cosignerHookErrorMessages;
|
|
4456
|
+
if (process.env.NODE_ENV !== "production") {
|
|
4457
|
+
cosignerHookErrorMessages = {
|
|
4458
|
+
[COSIGNER_HOOK_ERROR__COSIGNER_ALREADY_EXISTS]: `Cosigner already exists`,
|
|
4459
|
+
[COSIGNER_HOOK_ERROR__COSIGNER_LIST_FULL]: `Cosigner list is full`,
|
|
4460
|
+
[COSIGNER_HOOK_ERROR__COSIGNER_NOT_FOUND]: `Cosigner not found`,
|
|
4461
|
+
[COSIGNER_HOOK_ERROR__INVALID_AUTHORITY]: `Invalid cosigner hook authority`,
|
|
4462
|
+
[COSIGNER_HOOK_ERROR__INVALID_CONFIG]: `Invalid cosigner hook config`,
|
|
4463
|
+
[COSIGNER_HOOK_ERROR__INVALID_COSIGNER]: `Invalid cosigner key`
|
|
4464
|
+
};
|
|
4465
|
+
}
|
|
4466
|
+
function getCosignerHookErrorMessage(code) {
|
|
4467
|
+
if (process.env.NODE_ENV !== "production") {
|
|
4468
|
+
return cosignerHookErrorMessages[code];
|
|
4469
|
+
}
|
|
4470
|
+
return "Error message not available in production bundles.";
|
|
4471
|
+
}
|
|
4472
|
+
function isCosignerHookError(error, transactionMessage, code) {
|
|
4473
|
+
return kit.isProgramError(
|
|
4474
|
+
error,
|
|
4475
|
+
transactionMessage,
|
|
4476
|
+
COSIGNER_HOOK_PROGRAM_ADDRESS,
|
|
4477
|
+
code
|
|
4478
|
+
);
|
|
4479
|
+
}
|
|
4480
|
+
function getCosignerArgEncoder() {
|
|
4481
|
+
return kit.getStructEncoder([["cosigner", kit.getAddressEncoder()]]);
|
|
4482
|
+
}
|
|
4483
|
+
function getCosignerArgDecoder() {
|
|
4484
|
+
return kit.getStructDecoder([["cosigner", kit.getAddressDecoder()]]);
|
|
4485
|
+
}
|
|
4486
|
+
function getCosignerArgCodec() {
|
|
4487
|
+
return kit.combineCodec(getCosignerArgEncoder(), getCosignerArgDecoder());
|
|
4488
|
+
}
|
|
4489
|
+
function getInitializeConfigArgsEncoder() {
|
|
4490
|
+
return kit.getStructEncoder([
|
|
4491
|
+
["cosigners", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
4492
|
+
]);
|
|
4493
|
+
}
|
|
4494
|
+
function getInitializeConfigArgsDecoder() {
|
|
4495
|
+
return kit.getStructDecoder([
|
|
4496
|
+
["cosigners", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
4497
|
+
]);
|
|
4498
|
+
}
|
|
4499
|
+
function getInitializeConfigArgsCodec() {
|
|
4500
|
+
return kit.combineCodec(
|
|
4501
|
+
getInitializeConfigArgsEncoder(),
|
|
4502
|
+
getInitializeConfigArgsDecoder()
|
|
4503
|
+
);
|
|
4504
|
+
}
|
|
4505
|
+
function getSetAuthorityArgsEncoder() {
|
|
4506
|
+
return kit.getStructEncoder([["adminAuthority", kit.getAddressEncoder()]]);
|
|
4507
|
+
}
|
|
4508
|
+
function getSetAuthorityArgsDecoder() {
|
|
4509
|
+
return kit.getStructDecoder([["adminAuthority", kit.getAddressDecoder()]]);
|
|
4510
|
+
}
|
|
4511
|
+
function getSetAuthorityArgsCodec() {
|
|
4512
|
+
return kit.combineCodec(
|
|
4513
|
+
getSetAuthorityArgsEncoder(),
|
|
4514
|
+
getSetAuthorityArgsDecoder()
|
|
4515
|
+
);
|
|
4516
|
+
}
|
|
4517
|
+
|
|
4518
|
+
// src/solana/cosignerHook/constants.ts
|
|
4519
|
+
var COSIGNER_HOOK_PROGRAM_ID = COSIGNER_HOOK_PROGRAM_ADDRESS;
|
|
4520
|
+
var SEED_COSIGNER_HOOK_CONFIG = "cosigner_hook_config";
|
|
4521
|
+
var MAX_COSIGNERS = 32;
|
|
4522
|
+
var textEncoder2 = new TextEncoder();
|
|
4523
|
+
async function getCosignerHookConfigAddress(programId = COSIGNER_HOOK_PROGRAM_ID) {
|
|
4524
|
+
return kit.getProgramDerivedAddress({
|
|
4525
|
+
programAddress: programId,
|
|
4526
|
+
seeds: [textEncoder2.encode(SEED_COSIGNER_HOOK_CONFIG)]
|
|
4527
|
+
});
|
|
4528
|
+
}
|
|
4529
|
+
|
|
3606
4530
|
// src/solana/initializer/index.ts
|
|
3607
4531
|
var initializer_exports = {};
|
|
3608
4532
|
chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
@@ -3618,6 +4542,7 @@ chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
|
3618
4542
|
HF_BEFORE_CREATE: () => HF_BEFORE_CREATE,
|
|
3619
4543
|
HF_BEFORE_MIGRATE: () => HF_BEFORE_MIGRATE,
|
|
3620
4544
|
HF_BEFORE_SWAP: () => HF_BEFORE_SWAP2,
|
|
4545
|
+
HF_FORWARD_READONLY_SIGNERS: () => HF_FORWARD_READONLY_SIGNERS2,
|
|
3621
4546
|
HOOK_NO_CHANGE: () => HOOK_NO_CHANGE2,
|
|
3622
4547
|
INITIALIZER_ACCOUNT_DISCRIMINATORS: () => INITIALIZER_ACCOUNT_DISCRIMINATORS,
|
|
3623
4548
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS: () => INITIALIZER_INSTRUCTION_DISCRIMINATORS,
|
|
@@ -3655,9 +4580,9 @@ chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
|
3655
4580
|
getInitConfigCodec: () => getInitConfigCodec,
|
|
3656
4581
|
getInitConfigDecoder: () => getInitConfigDecoder,
|
|
3657
4582
|
getInitConfigEncoder: () => getInitConfigEncoder,
|
|
3658
|
-
getInitializeConfigArgsCodec: () =>
|
|
3659
|
-
getInitializeConfigArgsDecoder: () =>
|
|
3660
|
-
getInitializeConfigArgsEncoder: () =>
|
|
4583
|
+
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec2,
|
|
4584
|
+
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder2,
|
|
4585
|
+
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder2,
|
|
3661
4586
|
getInitializeLaunchArgsCodec: () => getInitializeLaunchArgsCodec,
|
|
3662
4587
|
getInitializeLaunchArgsDecoder: () => getInitializeLaunchArgsDecoder,
|
|
3663
4588
|
getInitializeLaunchArgsEncoder: () => getInitializeLaunchArgsEncoder,
|
|
@@ -3738,6 +4663,7 @@ var HF_BEFORE_CREATE = 1 << 2;
|
|
|
3738
4663
|
var HF_AFTER_CREATE = 1 << 3;
|
|
3739
4664
|
var HF_BEFORE_MIGRATE = 1 << 4;
|
|
3740
4665
|
var HF_AFTER_MIGRATE = 1 << 5;
|
|
4666
|
+
var HF_FORWARD_READONLY_SIGNERS2 = 1 << 6;
|
|
3741
4667
|
var HOOK_NO_CHANGE2 = 65535;
|
|
3742
4668
|
var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
|
|
3743
4669
|
// SHA256("global:initialize_config")[0:8]
|
|
@@ -3877,22 +4803,22 @@ function getInitConfigDecoder() {
|
|
|
3877
4803
|
function getInitConfigCodec() {
|
|
3878
4804
|
return kit.combineCodec(getInitConfigEncoder(), getInitConfigDecoder());
|
|
3879
4805
|
}
|
|
3880
|
-
function
|
|
4806
|
+
function getInitializeConfigArgsEncoder2() {
|
|
3881
4807
|
return kit.getStructEncoder([
|
|
3882
4808
|
["migratorAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())],
|
|
3883
4809
|
["hookAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
3884
4810
|
]);
|
|
3885
4811
|
}
|
|
3886
|
-
function
|
|
4812
|
+
function getInitializeConfigArgsDecoder2() {
|
|
3887
4813
|
return kit.getStructDecoder([
|
|
3888
4814
|
["migratorAllowlist", kit.getArrayDecoder(kit.getAddressDecoder())],
|
|
3889
4815
|
["hookAllowlist", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
3890
4816
|
]);
|
|
3891
4817
|
}
|
|
3892
|
-
function
|
|
4818
|
+
function getInitializeConfigArgsCodec2() {
|
|
3893
4819
|
return kit.combineCodec(
|
|
3894
|
-
|
|
3895
|
-
|
|
4820
|
+
getInitializeConfigArgsEncoder2(),
|
|
4821
|
+
getInitializeConfigArgsDecoder2()
|
|
3896
4822
|
);
|
|
3897
4823
|
}
|
|
3898
4824
|
function getInitializeLaunchArgsEncoder() {
|
|
@@ -4112,7 +5038,7 @@ function getCurveSwapExactInInstructionDataEncoder() {
|
|
|
4112
5038
|
(value) => ({ ...value, discriminator: CURVE_SWAP_EXACT_IN_DISCRIMINATOR })
|
|
4113
5039
|
);
|
|
4114
5040
|
}
|
|
4115
|
-
var
|
|
5041
|
+
var INITIALIZE_CONFIG_DISCRIMINATOR3 = new Uint8Array([
|
|
4116
5042
|
208,
|
|
4117
5043
|
127,
|
|
4118
5044
|
21,
|
|
@@ -4122,14 +5048,14 @@ var INITIALIZE_CONFIG_DISCRIMINATOR2 = new Uint8Array([
|
|
|
4122
5048
|
196,
|
|
4123
5049
|
70
|
|
4124
5050
|
]);
|
|
4125
|
-
function
|
|
5051
|
+
function getInitializeConfigInstructionDataEncoder3() {
|
|
4126
5052
|
return kit.transformEncoder(
|
|
4127
5053
|
kit.getStructEncoder([
|
|
4128
5054
|
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
4129
5055
|
["migratorAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())],
|
|
4130
5056
|
["hookAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
4131
5057
|
]),
|
|
4132
|
-
(value) => ({ ...value, discriminator:
|
|
5058
|
+
(value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR3 })
|
|
4133
5059
|
);
|
|
4134
5060
|
}
|
|
4135
5061
|
var INITIALIZE_LAUNCH_DISCRIMINATOR = new Uint8Array([
|
|
@@ -4258,7 +5184,7 @@ function getSetMigratorAllowlistInstructionDataEncoder() {
|
|
|
4258
5184
|
}
|
|
4259
5185
|
if (process.env.NODE_ENV !== "production") ;
|
|
4260
5186
|
var addressCodec2 = kit.getAddressCodec();
|
|
4261
|
-
var
|
|
5187
|
+
var textEncoder3 = new TextEncoder();
|
|
4262
5188
|
function encodeU64LE(value) {
|
|
4263
5189
|
const bytes = new Uint8Array(8);
|
|
4264
5190
|
const view = new DataView(bytes.buffer);
|
|
@@ -4268,7 +5194,7 @@ function encodeU64LE(value) {
|
|
|
4268
5194
|
async function getConfigAddress2(programId = INITIALIZER_PROGRAM_ID) {
|
|
4269
5195
|
return kit.getProgramDerivedAddress({
|
|
4270
5196
|
programAddress: programId,
|
|
4271
|
-
seeds: [
|
|
5197
|
+
seeds: [textEncoder3.encode(SEED_CONFIG2)]
|
|
4272
5198
|
});
|
|
4273
5199
|
}
|
|
4274
5200
|
async function getProgramDataAddress(programId = INITIALIZER_PROGRAM_ID) {
|
|
@@ -4284,7 +5210,7 @@ async function getLaunchAddress(namespace, launchId, programId = INITIALIZER_PRO
|
|
|
4284
5210
|
return kit.getProgramDerivedAddress({
|
|
4285
5211
|
programAddress: programId,
|
|
4286
5212
|
seeds: [
|
|
4287
|
-
|
|
5213
|
+
textEncoder3.encode(SEED_LAUNCH),
|
|
4288
5214
|
addressCodec2.encode(namespace),
|
|
4289
5215
|
launchId
|
|
4290
5216
|
]
|
|
@@ -4294,7 +5220,7 @@ async function getLaunchAuthorityAddress(launch, programId = INITIALIZER_PROGRAM
|
|
|
4294
5220
|
return kit.getProgramDerivedAddress({
|
|
4295
5221
|
programAddress: programId,
|
|
4296
5222
|
seeds: [
|
|
4297
|
-
|
|
5223
|
+
textEncoder3.encode(SEED_LAUNCH_AUTHORITY),
|
|
4298
5224
|
addressCodec2.encode(launch)
|
|
4299
5225
|
]
|
|
4300
5226
|
});
|
|
@@ -4327,7 +5253,7 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
4327
5253
|
{ address: systemProgram, role: kit.AccountRole.READONLY }
|
|
4328
5254
|
];
|
|
4329
5255
|
const data = new Uint8Array(
|
|
4330
|
-
|
|
5256
|
+
getInitializeConfigInstructionDataEncoder3().encode(args)
|
|
4331
5257
|
);
|
|
4332
5258
|
return { programAddress: programId, accounts: keys, data };
|
|
4333
5259
|
}
|
|
@@ -4427,17 +5353,17 @@ var CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS = {
|
|
|
4427
5353
|
])
|
|
4428
5354
|
};
|
|
4429
5355
|
var addressCodec3 = kit.getAddressCodec();
|
|
4430
|
-
var
|
|
5356
|
+
var textEncoder4 = new TextEncoder();
|
|
4431
5357
|
async function getCpmmMigratorStateAddress(launch, programId = CPMM_MIGRATOR_PROGRAM_ID) {
|
|
4432
5358
|
return kit.getProgramDerivedAddress({
|
|
4433
5359
|
programAddress: programId,
|
|
4434
|
-
seeds: [
|
|
5360
|
+
seeds: [textEncoder4.encode(SEED_STATE), addressCodec3.encode(launch)]
|
|
4435
5361
|
});
|
|
4436
5362
|
}
|
|
4437
5363
|
async function getCpmmMigrationAuthorityAddress(programId = CPMM_MIGRATOR_PROGRAM_ID) {
|
|
4438
5364
|
return kit.getProgramDerivedAddress({
|
|
4439
5365
|
programAddress: programId,
|
|
4440
|
-
seeds: [
|
|
5366
|
+
seeds: [textEncoder4.encode(SEED_MIGRATION_AUTHORITY)]
|
|
4441
5367
|
});
|
|
4442
5368
|
}
|
|
4443
5369
|
var CLAIM_RECEIPT_DISCRIMINATOR = new Uint8Array([
|
|
@@ -6320,12 +7246,12 @@ function predictionMigratorProgram() {
|
|
|
6320
7246
|
};
|
|
6321
7247
|
}
|
|
6322
7248
|
var addressCodec4 = kit.getAddressCodec();
|
|
6323
|
-
var
|
|
7249
|
+
var textEncoder5 = new TextEncoder();
|
|
6324
7250
|
async function getPredictionMarketAddress(oracleState, quoteMint, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
6325
7251
|
return kit.getProgramDerivedAddress({
|
|
6326
7252
|
programAddress: programId,
|
|
6327
7253
|
seeds: [
|
|
6328
|
-
|
|
7254
|
+
textEncoder5.encode("market"),
|
|
6329
7255
|
addressCodec4.encode(oracleState),
|
|
6330
7256
|
addressCodec4.encode(quoteMint)
|
|
6331
7257
|
]
|
|
@@ -6335,7 +7261,7 @@ async function getPredictionMarketAuthorityAddress(market, programId = PREDICTIO
|
|
|
6335
7261
|
return kit.getProgramDerivedAddress({
|
|
6336
7262
|
programAddress: programId,
|
|
6337
7263
|
seeds: [
|
|
6338
|
-
|
|
7264
|
+
textEncoder5.encode("market_authority"),
|
|
6339
7265
|
addressCodec4.encode(market)
|
|
6340
7266
|
]
|
|
6341
7267
|
});
|
|
@@ -6343,20 +7269,20 @@ async function getPredictionMarketAuthorityAddress(market, programId = PREDICTIO
|
|
|
6343
7269
|
async function getPredictionPotVaultAddress(market, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
6344
7270
|
return kit.getProgramDerivedAddress({
|
|
6345
7271
|
programAddress: programId,
|
|
6346
|
-
seeds: [
|
|
7272
|
+
seeds: [textEncoder5.encode("pot_vault"), addressCodec4.encode(market)]
|
|
6347
7273
|
});
|
|
6348
7274
|
}
|
|
6349
7275
|
async function getPredictionEntryAddress(market, entryId, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
6350
7276
|
return kit.getProgramDerivedAddress({
|
|
6351
7277
|
programAddress: programId,
|
|
6352
|
-
seeds: [
|
|
7278
|
+
seeds: [textEncoder5.encode("entry"), addressCodec4.encode(market), entryId]
|
|
6353
7279
|
});
|
|
6354
7280
|
}
|
|
6355
7281
|
async function getPredictionEntryByMintAddress(market, mint, programId = PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
6356
7282
|
return kit.getProgramDerivedAddress({
|
|
6357
7283
|
programAddress: programId,
|
|
6358
7284
|
seeds: [
|
|
6359
|
-
|
|
7285
|
+
textEncoder5.encode("entry_by_mint"),
|
|
6360
7286
|
addressCodec4.encode(market),
|
|
6361
7287
|
addressCodec4.encode(mint)
|
|
6362
7288
|
]
|
|
@@ -6526,6 +7452,19 @@ function createAccountMeta2(value, role) {
|
|
|
6526
7452
|
}
|
|
6527
7453
|
return { address: value, role };
|
|
6528
7454
|
}
|
|
7455
|
+
function createRemainingAccountMeta(value) {
|
|
7456
|
+
if (typeof value === "string") {
|
|
7457
|
+
return { address: value, role: kit.AccountRole.READONLY };
|
|
7458
|
+
}
|
|
7459
|
+
if (isTransactionSigner6(value)) {
|
|
7460
|
+
return {
|
|
7461
|
+
address: value.address,
|
|
7462
|
+
role: kit.AccountRole.READONLY_SIGNER,
|
|
7463
|
+
signer: value
|
|
7464
|
+
};
|
|
7465
|
+
}
|
|
7466
|
+
return value;
|
|
7467
|
+
}
|
|
6529
7468
|
function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
|
|
6530
7469
|
const {
|
|
6531
7470
|
config,
|
|
@@ -6540,7 +7479,8 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
6540
7479
|
user,
|
|
6541
7480
|
hookProgram = chunk3BW6IVP3_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6542
7481
|
baseTokenProgram = chunk3BW6IVP3_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6543
|
-
quoteTokenProgram = chunk3BW6IVP3_cjs.TOKEN_PROGRAM_ADDRESS
|
|
7482
|
+
quoteTokenProgram = chunk3BW6IVP3_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
7483
|
+
remainingAccounts = []
|
|
6544
7484
|
} = accounts;
|
|
6545
7485
|
const keys = [
|
|
6546
7486
|
{ address: config, role: kit.AccountRole.READONLY },
|
|
@@ -6558,7 +7498,8 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
6558
7498
|
// no-op placeholder when no real hook is configured.
|
|
6559
7499
|
{ address: hookProgram, role: kit.AccountRole.READONLY },
|
|
6560
7500
|
{ address: baseTokenProgram, role: kit.AccountRole.READONLY },
|
|
6561
|
-
{ address: quoteTokenProgram, role: kit.AccountRole.READONLY }
|
|
7501
|
+
{ address: quoteTokenProgram, role: kit.AccountRole.READONLY },
|
|
7502
|
+
...remainingAccounts.map(createRemainingAccountMeta)
|
|
6562
7503
|
];
|
|
6563
7504
|
const data = new Uint8Array(
|
|
6564
7505
|
getCurveSwapExactInInstructionDataEncoder().encode(args)
|
|
@@ -6610,22 +7551,48 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
6610
7551
|
);
|
|
6611
7552
|
return { programAddress: programId, accounts: keys, data };
|
|
6612
7553
|
}
|
|
7554
|
+
function isTransactionSigner8(value) {
|
|
7555
|
+
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
7556
|
+
}
|
|
7557
|
+
function createRemainingAccountMeta2(value) {
|
|
7558
|
+
if (typeof value === "string") {
|
|
7559
|
+
return { address: value, role: kit.AccountRole.READONLY };
|
|
7560
|
+
}
|
|
7561
|
+
if (isTransactionSigner8(value)) {
|
|
7562
|
+
return {
|
|
7563
|
+
address: value.address,
|
|
7564
|
+
role: kit.AccountRole.READONLY_SIGNER,
|
|
7565
|
+
signer: value
|
|
7566
|
+
};
|
|
7567
|
+
}
|
|
7568
|
+
return value;
|
|
7569
|
+
}
|
|
6613
7570
|
var previewSwapExactInResultCodec = kit.getStructCodec([
|
|
6614
7571
|
["amountOut", kit.getU64Codec()],
|
|
6615
7572
|
["feePaid", kit.getU64Codec()]
|
|
6616
7573
|
]);
|
|
6617
7574
|
function createPreviewSwapExactInInstruction(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
|
|
6618
|
-
const {
|
|
7575
|
+
const {
|
|
7576
|
+
launch,
|
|
7577
|
+
baseVault,
|
|
7578
|
+
quoteVault,
|
|
7579
|
+
hookProgram,
|
|
7580
|
+
remainingAccounts = []
|
|
7581
|
+
} = accounts;
|
|
6619
7582
|
const keys = [
|
|
6620
7583
|
{ address: launch, role: kit.AccountRole.READONLY },
|
|
6621
7584
|
{ address: baseVault, role: kit.AccountRole.READONLY },
|
|
6622
7585
|
{ address: quoteVault, role: kit.AccountRole.READONLY }
|
|
6623
7586
|
];
|
|
6624
7587
|
const accountsList = hookProgram ? [...keys, { address: hookProgram, role: kit.AccountRole.READONLY }] : keys;
|
|
7588
|
+
const accountsWithRemaining = [
|
|
7589
|
+
...accountsList,
|
|
7590
|
+
...remainingAccounts.map(createRemainingAccountMeta2)
|
|
7591
|
+
];
|
|
6625
7592
|
const data = new Uint8Array(
|
|
6626
7593
|
getPreviewSwapExactInInstructionDataEncoder2().encode(args)
|
|
6627
7594
|
);
|
|
6628
|
-
return { programAddress: programId, accounts:
|
|
7595
|
+
return { programAddress: programId, accounts: accountsWithRemaining, data };
|
|
6629
7596
|
}
|
|
6630
7597
|
function decodePreviewSwapExactInResult(data) {
|
|
6631
7598
|
return previewSwapExactInResultCodec.decode(data);
|
|
@@ -7777,7 +8744,8 @@ var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
|
|
|
7777
8744
|
cpmmProgram: chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID,
|
|
7778
8745
|
initializerProgram: INITIALIZER_PROGRAM_ID,
|
|
7779
8746
|
cpmmMigratorProgram: CPMM_MIGRATOR_PROGRAM_ID,
|
|
7780
|
-
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID
|
|
8747
|
+
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID,
|
|
8748
|
+
cosignerHookProgram: COSIGNER_HOOK_PROGRAM_ID
|
|
7781
8749
|
};
|
|
7782
8750
|
async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES) {
|
|
7783
8751
|
const [cpmmConfig] = await chunk3BW6IVP3_cjs.getConfigAddress(programs.cpmmProgram);
|
|
@@ -7792,6 +8760,7 @@ async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGR
|
|
|
7792
8760
|
}
|
|
7793
8761
|
|
|
7794
8762
|
exports.DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES;
|
|
8763
|
+
exports.cosignerHook = cosignerHook_exports;
|
|
7795
8764
|
exports.cpmm = cpmm_exports;
|
|
7796
8765
|
exports.cpmmMigrator = cpmmMigrator_exports;
|
|
7797
8766
|
exports.deriveSolanaCpmmDeployment = deriveSolanaCpmmDeployment;
|