diff --git a/package.json b/package.json index 5ffb1e33f..d3b3190f4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@zetamarkets/sdk", "repository": "https://github.com/zetamarkets/sdk/", - "version": "1.28.1", + "version": "1.29.0", "description": "Zeta SDK", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/cross-client.ts b/src/cross-client.ts index c32a4e40a..5ce7f13eb 100644 --- a/src/cross-client.ts +++ b/src/cross-client.ts @@ -1983,6 +1983,32 @@ export class CrossClient { return txSig; } + public async chooseAirdropCommunity( + community: types.AirdropCommunity + ): Promise { + this.delegatedCheck(); + let tx = new Transaction(); + + tx.add( + instructions.chooseAirdropCommunityIx( + community, + this.accountManagerAddress, + this._provider.wallet.publicKey + ) + ); + + return await utils.processTransaction( + this._provider, + tx, + undefined, + undefined, + undefined, + this._useVersionedTxs ? utils.getZetaLutArr() : undefined, + undefined, + this._txRetryAmount + ); + } + public async editDelegatedPubkey( delegatedPubkey: PublicKey ): Promise { diff --git a/src/idl/zeta.json b/src/idl/zeta.json index c9309a153..93ad72dba 100644 --- a/src/idl/zeta.json +++ b/src/idl/zeta.json @@ -2159,6 +2159,27 @@ } ] }, + { + "name": "chooseAirdropCommunity", + "accounts": [ + { + "name": "crossMarginAccountManager", + "isMut": true, + "isSigner": false + }, + { + "name": "authority", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "community", + "type": "u8" + } + ] + }, { "name": "withdraw", "accounts": [ @@ -8053,12 +8074,16 @@ "name": "referrer", "type": "publicKey" }, + { + "name": "airdropCommunity", + "type": "u8" + }, { "name": "padding", "type": { "array": [ "u8", - 23 + 22 ] } } @@ -11278,6 +11303,11 @@ "code": 6170, "name": "OrderPriceTooFarFromMarkPrice", "msg": "Order price too far from mark price" + }, + { + "code": 6171, + "name": "AirdropCommunityAlreadySet", + "msg": "Airdrop community already set, cannot set again" } ] } \ No newline at end of file diff --git a/src/program-instructions.ts b/src/program-instructions.ts index e131b6f62..8b4956b91 100644 --- a/src/program-instructions.ts +++ b/src/program-instructions.ts @@ -2322,6 +2322,19 @@ export function toggleMarketMakerIx( }); } +export function chooseAirdropCommunityIx( + community: number, + accountManager: PublicKey, + authority: PublicKey +): TransactionInstruction { + return Exchange.program.instruction.chooseAirdropCommunity(community, { + accounts: { + crossMarginAccountManager: accountManager, + authority, + }, + }); +} + export function editDelegatedPubkeyIx( delegatedPubkey: PublicKey, account: PublicKey, diff --git a/src/program-types.ts b/src/program-types.ts index 63861e266..3c16ca117 100644 --- a/src/program-types.ts +++ b/src/program-types.ts @@ -192,6 +192,7 @@ export interface CrossMarginAccountManager { authority: PublicKey; accounts: Array; referrer: PublicKey; + airdropCommunity: number; padding: Array; } diff --git a/src/types.ts b/src/types.ts index fa133ad4b..8e2bd44a0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -667,3 +667,16 @@ export interface PlaceMultiOrderArg { tifOptions: TIFOptions; clientOrderId?: number; } + + +export enum AirdropCommunity { + UNASSIGNED = 0, + BACKPACK = 1, + JUP = 2, + PYTH = 3, + DEBRIDGE = 4, + SUPERTEAM = 5, + MADLADS = 6, + TENSORIANS = 7, + ASSETDASH = 8 +} \ No newline at end of file diff --git a/src/types/zeta.ts b/src/types/zeta.ts index 186e52d36..63ff76756 100644 --- a/src/types/zeta.ts +++ b/src/types/zeta.ts @@ -2159,6 +2159,27 @@ export type Zeta = { } ] }, + { + "name": "chooseAirdropCommunity", + "accounts": [ + { + "name": "crossMarginAccountManager", + "isMut": true, + "isSigner": false + }, + { + "name": "authority", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "community", + "type": "u8" + } + ] + }, { "name": "withdraw", "accounts": [ @@ -8053,12 +8074,16 @@ export type Zeta = { "name": "referrer", "type": "publicKey" }, + { + "name": "airdropCommunity", + "type": "u8" + }, { "name": "padding", "type": { "array": [ "u8", - 23 + 22 ] } } @@ -11278,6 +11303,11 @@ export type Zeta = { "code": 6170, "name": "OrderPriceTooFarFromMarkPrice", "msg": "Order price too far from mark price" + }, + { + "code": 6171, + "name": "AirdropCommunityAlreadySet", + "msg": "Airdrop community already set, cannot set again" } ] }; @@ -13443,6 +13473,27 @@ export const IDL: Zeta = { } ] }, + { + "name": "chooseAirdropCommunity", + "accounts": [ + { + "name": "crossMarginAccountManager", + "isMut": true, + "isSigner": false + }, + { + "name": "authority", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "community", + "type": "u8" + } + ] + }, { "name": "withdraw", "accounts": [ @@ -19337,12 +19388,16 @@ export const IDL: Zeta = { "name": "referrer", "type": "publicKey" }, + { + "name": "airdropCommunity", + "type": "u8" + }, { "name": "padding", "type": { "array": [ "u8", - 23 + 22 ] } } @@ -22562,6 +22617,11 @@ export const IDL: Zeta = { "code": 6170, "name": "OrderPriceTooFarFromMarkPrice", "msg": "Order price too far from mark price" + }, + { + "code": 6171, + "name": "AirdropCommunityAlreadySet", + "msg": "Airdrop community already set, cannot set again" } ] };