Skip to content

Commit

Permalink
place order and settle for fill city
Browse files Browse the repository at this point in the history
  • Loading branch information
mschneider committed Oct 22, 2024
1 parent b04abab commit 3508dc6
Show file tree
Hide file tree
Showing 35 changed files with 3,247 additions and 594 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-autogen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:

- uses: nickcharlton/diff-check@main
with:
command: cd client/idl && yarn && node generateIdl.js && node generateClient.js && node generateIdl.js && cd - ; npm install -g prettier; prettier client/ts --write ; prettier client/ts/src/manifest --write; prettier client/ts/src/wrapper --write; git diff;
command: cd client/idl && yarn && node generateIdl.js && node generateClient.js && node generateIdl.js && cd - ; npm install -g prettier; prettier client/ts --write ; prettier client/ts/src/manifest --write; prettier client/ts/src/wrapper --write; prettier client/ts/src/ui_wrapper --write; git diff;
2 changes: 1 addition & 1 deletion client/idl/generateIdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ function modifyIdlCore(programName) {
case 'CreateWrapper': {
break;
}
case 'ClaimSeat': {
case 'ClaimSeatUnused': {
// Claim seat does not have params
break;
}
Expand Down
180 changes: 178 additions & 2 deletions client/idl/ui_wrapper.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}
},
{
"name": "ClaimSeat",
"name": "ClaimSeatUnused",
"accounts": [
{
"name": "manifestProgram",
Expand Down Expand Up @@ -281,7 +281,168 @@
},
{
"name": "EditOrder",
"accounts": [],
"accounts": [
{
"name": "wrapperState",
"isMut": true,
"isSigner": false,
"docs": [
"Wrapper state"
]
},
{
"name": "owner",
"isMut": false,
"isSigner": true,
"docs": [
"Owner of the Manifest account"
]
},
{
"name": "traderTokenAccount",
"isMut": true,
"isSigner": false,
"docs": [
"Trader token account"
]
},
{
"name": "market",
"isMut": true,
"isSigner": false,
"docs": [
"Account holding all market state"
]
},
{
"name": "vault",
"isMut": true,
"isSigner": false,
"docs": [
"Vault PDA, seeds are [b'vault', market_address, mint_address]"
]
},
{
"name": "mint",
"isMut": true,
"isSigner": false,
"docs": [
"Mint of trader token account"
]
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false,
"docs": [
"System program"
]
},
{
"name": "tokenProgram",
"isMut": false,
"isSigner": false,
"docs": [
"Token program owning trader token account"
]
},
{
"name": "manifestProgram",
"isMut": false,
"isSigner": false,
"docs": [
"Manifest program"
]
},
{
"name": "payer",
"isMut": true,
"isSigner": true,
"docs": [
"Payer of rent and gas"
]
},
{
"name": "baseMint",
"isMut": false,
"isSigner": false,
"docs": [
"Base mint"
]
},
{
"name": "baseGlobal",
"isMut": true,
"isSigner": false,
"docs": [
"Base global account"
]
},
{
"name": "baseGlobalVault",
"isMut": true,
"isSigner": false,
"docs": [
"Base global vault"
]
},
{
"name": "baseMarketVault",
"isMut": true,
"isSigner": false,
"docs": [
"Base market vault"
]
},
{
"name": "baseTokenProgram",
"isMut": true,
"isSigner": false,
"docs": [
"Base token program"
]
},
{
"name": "quoteMint",
"isMut": false,
"isSigner": false,
"docs": [
"Quote mint"
]
},
{
"name": "quoteGlobal",
"isMut": true,
"isSigner": false,
"docs": [
"Quote global account"
]
},
{
"name": "quoteGlobalVault",
"isMut": true,
"isSigner": false,
"docs": [
"Quote global vault"
]
},
{
"name": "quoteMarketVault",
"isMut": true,
"isSigner": false,
"docs": [
"Quote market vault"
]
},
{
"name": "quoteTokenProgram",
"isMut": true,
"isSigner": false,
"docs": [
"Quote token program"
]
}
],
"args": [],
"discriminant": {
"type": "u8",
Expand Down Expand Up @@ -521,6 +682,10 @@
"name": "user",
"type": "publicKey"
},
{
"name": "mint",
"type": "publicKey"
},
{
"name": "platformTokenAccount",
"type": "publicKey"
Expand All @@ -545,6 +710,10 @@
"name": "user",
"type": "publicKey"
},
{
"name": "mint",
"type": "publicKey"
},
{
"name": "referrerTokenAccount",
"type": "publicKey"
Expand Down Expand Up @@ -742,6 +911,13 @@
}
}
],
"errors": [
{
"code": 0,
"name": "InvalidDepositAccounts",
"msg": "Invalid deposit accounts error"
}
],
"metadata": {
"origin": "shank",
"address": "UMnFStVeG1ecZFc2gc5K3vFy3sMpotq8C91mXBQDGwh"
Expand Down
10 changes: 5 additions & 5 deletions client/ts/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from './manifest/instructions';
import { OrderType, SwapParams } from './manifest/types';
import { Market } from './market';
import { MarketInfoParsed, Wrapper, WrapperData } from './wrapperObj';
import { WrapperMarketInfo, Wrapper, WrapperData } from './wrapperObj';
import { PROGRAM_ID as MANIFEST_PROGRAM_ID, PROGRAM_ID } from './manifest';
import {
PROGRAM_ID as WRAPPER_PROGRAM_ID,
Expand Down Expand Up @@ -226,8 +226,8 @@ export class ManifestClient {
const wrapperData: WrapperData = Wrapper.deserializeWrapperBuffer(
userWrapper.account.data,
);
const existingMarketInfos: MarketInfoParsed[] =
wrapperData.marketInfos.filter((marketInfo: MarketInfoParsed) => {
const existingMarketInfos: WrapperMarketInfo[] =
wrapperData.marketInfos.filter((marketInfo: WrapperMarketInfo) => {
return marketInfo.market.toBase58() == marketPk.toBase58();
});
if (existingMarketInfos.length > 0) {
Expand Down Expand Up @@ -335,8 +335,8 @@ export class ManifestClient {
userWrapper.account.data,
);

const existingMarketInfos: MarketInfoParsed[] =
wrapperData.marketInfos.filter((marketInfo: MarketInfoParsed) => {
const existingMarketInfos: WrapperMarketInfo[] =
wrapperData.marketInfos.filter((marketInfo: WrapperMarketInfo) => {
return marketInfo.market.toBase58() == marketPk.toBase58();
});
if (existingMarketInfos.length > 0) {
Expand Down
10 changes: 5 additions & 5 deletions client/ts/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export * from './client';
export * from './market';
export * from './types';
// Do not export all of manifest because names collide with wrapper. Force users
// to use the client.
export * from './manifest/errors';
export * from './manifest/accounts';
export * from './wrapper';
export * as manifest from './manifest';
export * as utils from './utils';
export * as wrapper from './wrapper';
export * from './wrapperObj';
export * as uiWrapper from './ui_wrapper';
export * from './uiWrapperObj';
10 changes: 5 additions & 5 deletions client/ts/src/market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import {
} from './constants';
import {
claimedSeatBeet,
ClaimedSeat as ClaimedSeatInternal,
ClaimedSeat as ClaimedSeatRaw,
createCreateMarketInstruction,
PROGRAM_ID,
restingOrderBeet,
RestingOrder as RestingOrderInternal,
RestingOrder as RestingOrderRaw,
} from './manifest';
import { getVaultAddress } from './utils/market';
import { TOKEN_2022_PROGRAM_ID } from '@solana/spl-token';
Expand Down Expand Up @@ -500,7 +500,7 @@ export class Market {
bidsRootIndex,
restingOrderBeet,
)
.map((restingOrderInternal: RestingOrderInternal) => {
.map((restingOrderInternal: RestingOrderRaw) => {
return {
trader: publicKeyBeet.deserialize(
data.subarray(
Expand Down Expand Up @@ -536,7 +536,7 @@ export class Market {
asksRootIndex,
restingOrderBeet,
)
.map((restingOrderInternal: RestingOrderInternal) => {
.map((restingOrderInternal: RestingOrderRaw) => {
return {
trader: publicKeyBeet.deserialize(
data.subarray(
Expand Down Expand Up @@ -571,7 +571,7 @@ export class Market {
data.subarray(FIXED_MANIFEST_HEADER_SIZE),
claimedSeatsRootIndex,
claimedSeatBeet,
).map((claimedSeatInternal: ClaimedSeatInternal) => {
).map((claimedSeatInternal: ClaimedSeatRaw) => {
return {
publicKey: claimedSeatInternal.trader,
baseBalance: claimedSeatInternal.baseWithdrawableBalance,
Expand Down
Loading

0 comments on commit 3508dc6

Please sign in to comment.