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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@coral-xyz/anchor": "0.29.0",
"@inquirer/prompts": "^7.3.3",
"@metadaoproject/futarchy": "0.4.0-alpha.57",
"@metadaoproject/futarchy": "0.4.0-alpha.67",
"@metaplex-foundation/mpl-token-metadata": "^3.2.0",
"@metaplex-foundation/umi": "^0.9.1",
"@metaplex-foundation/umi-bundle-defaults": "^0.9.1",
Expand Down
2 changes: 1 addition & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metadaoproject/futarchy",
"version": "0.4.0-alpha.58",
"version": "0.4.0-alpha.67",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
21 changes: 12 additions & 9 deletions sdk/src/v0.4/AmmClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class AmmClient {
) {
const [lpMint] = getAmmLpMintAddr(this.program.programId, amm);

const userLpAccount = getAssociatedTokenAddressSync(lpMint, user);
const userLpAccount = getAssociatedTokenAddressSync(lpMint, user, true);

return this.program.methods
.addLiquidity({
Expand All @@ -242,16 +242,16 @@ export class AmmClient {
amm,
lpMint,
userLpAccount,
userBaseAccount: getAssociatedTokenAddressSync(baseMint, user),
userQuoteAccount: getAssociatedTokenAddressSync(quoteMint, user),
userBaseAccount: getAssociatedTokenAddressSync(baseMint, user, true),
userQuoteAccount: getAssociatedTokenAddressSync(quoteMint, user, true),
vaultAtaBase: getAssociatedTokenAddressSync(baseMint, amm, true),
vaultAtaQuote: getAssociatedTokenAddressSync(quoteMint, amm, true),
})
.preInstructions([
createAssociatedTokenAccountIdempotentInstruction(
this.provider.publicKey,
user,
userLpAccount,
this.provider.publicKey,
user,
lpMint
),
]);
Expand Down Expand Up @@ -279,15 +279,18 @@ export class AmmClient {
lpMint,
userLpAccount: getAssociatedTokenAddressSync(
lpMint,
this.provider.publicKey
this.provider.publicKey,
true
),
userBaseAccount: getAssociatedTokenAddressSync(
baseMint,
this.provider.publicKey
this.provider.publicKey,
true
),
userQuoteAccount: getAssociatedTokenAddressSync(
quoteMint,
this.provider.publicKey
this.provider.publicKey,
true
),
vaultAtaBase: getAssociatedTokenAddressSync(baseMint, ammAddr, true),
vaultAtaQuote: getAssociatedTokenAddressSync(quoteMint, ammAddr, true),
Expand Down Expand Up @@ -354,7 +357,7 @@ export class AmmClient {
// create the receiving token account if it doesn't exist
createAssociatedTokenAccountIdempotentInstruction(
user,
getAssociatedTokenAddressSync(receivingToken, user),
getAssociatedTokenAddressSync(receivingToken, user, true),
user,
receivingToken
),
Expand Down
25 changes: 12 additions & 13 deletions sdk/src/v0.4/AutocratClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,10 @@ export class AutocratClient {
passLpTokensToLock: BN,
failLpTokensToLock: BN,
nonce: BN,
question: PublicKey
question: PublicKey,
proposer: PublicKey = this.provider.publicKey
) {
let [proposal] = getProposalAddr(
this.autocrat.programId,
this.provider.publicKey,
nonce
);
let [proposal] = getProposalAddr(this.autocrat.programId, proposer, nonce);
const [daoTreasury] = getDaoTreasuryAddr(this.autocrat.programId, dao);
const { baseVault, quoteVault, passAmm, failAmm } = this.getProposalPdas(
proposal,
Expand Down Expand Up @@ -625,25 +622,27 @@ export class AutocratClient {
failLpMint: failLp,
passLpUserAccount: getAssociatedTokenAddressSync(
passLp,
this.provider.publicKey
proposer,
true
),
failLpUserAccount: getAssociatedTokenAddressSync(
failLp,
this.provider.publicKey
proposer,
true
),
passLpVaultAccount,
failLpVaultAccount,
proposer: this.provider.publicKey,
proposer,
})
.preInstructions([
createAssociatedTokenAccountIdempotentInstruction(
this.provider.publicKey,
proposer,
passLpVaultAccount,
daoTreasury,
passLp
),
createAssociatedTokenAccountIdempotentInstruction(
this.provider.publicKey,
proposer,
failLpVaultAccount,
daoTreasury,
failLp
Expand Down Expand Up @@ -702,8 +701,8 @@ export class AutocratClient {
question,
// baseVault,
// quoteVault,
passLpUserAccount: getAssociatedTokenAddressSync(passLp, proposer),
failLpUserAccount: getAssociatedTokenAddressSync(failLp, proposer),
passLpUserAccount: getAssociatedTokenAddressSync(passLp, proposer, true),
failLpUserAccount: getAssociatedTokenAddressSync(failLp, proposer, true),
passLpVaultAccount: getAssociatedTokenAddressSync(
passLp,
daoTreasury,
Expand Down
10 changes: 5 additions & 5 deletions sdk/src/v0.4/ConditionalVaultClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class ConditionalVaultClient {
vault: PublicKey,
numOutcomes: number,
user: PublicKey,
payer: PublicKey = this.provider.publicKey
payer?: PublicKey
) {
const conditionalTokenMintAddrs = this.getConditionalTokenMints(
vault,
Expand All @@ -259,8 +259,8 @@ export class ConditionalVaultClient {

const preInstructions = conditionalTokenMintAddrs.map((mint) =>
createAssociatedTokenAccountIdempotentInstruction(
payer,
getAssociatedTokenAddressSync(mint, user),
payer ?? user,
getAssociatedTokenAddressSync(mint, user, true),
user,
mint
)
Expand Down Expand Up @@ -348,7 +348,7 @@ export class ConditionalVaultClient {
conditionalTokenMintAddrs.map((conditionalTokenMint) => {
return createAssociatedTokenAccountIdempotentInstruction(
payer,
getAssociatedTokenAddressSync(conditionalTokenMint, user),
getAssociatedTokenAddressSync(conditionalTokenMint, user, true),
user,
conditionalTokenMint
);
Expand Down Expand Up @@ -415,7 +415,7 @@ export class ConditionalVaultClient {
conditionalTokenMintAddrs.map((conditionalTokenMint) => {
return createAssociatedTokenAccountIdempotentInstruction(
payer,
getAssociatedTokenAddressSync(conditionalTokenMint, user),
getAssociatedTokenAddressSync(conditionalTokenMint, user, true),
user,
conditionalTokenMint
);
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/v0.4/LaunchpadClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class LaunchpadClient {
launchSigner,
true
);
const funderUsdcAccount = getAssociatedTokenAddressSync(USDC, funder);
const funderUsdcAccount = getAssociatedTokenAddressSync(USDC, funder, true);
const [fundingRecord] = getFundingRecordAddr(
this.launchpad.programId,
launch,
Expand Down Expand Up @@ -353,7 +353,7 @@ export class LaunchpadClient {
launchSigner,
true
);
const funderUsdcAccount = getAssociatedTokenAddressSync(USDC, funder);
const funderUsdcAccount = getAssociatedTokenAddressSync(USDC, funder, true);

return this.launchpad.methods.refund().accounts({
launch,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -786,10 +786,10 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@metadaoproject/futarchy@0.4.0-alpha.57":
version "0.4.0-alpha.57"
resolved "https://registry.yarnpkg.com/@metadaoproject/futarchy/-/futarchy-0.4.0-alpha.57.tgz#2872d4b35bed5dd79963206d6243e443ce4a3c6f"
integrity sha512-m5rDyjppgbLAFTJOqdZQvucP91J7ByagL6+ynJC+N4OlCLF1h28nooKnRO1Hc8OFTxi53gstV9IlMxRKS2wazw==
"@metadaoproject/futarchy@0.4.0-alpha.63":
version "0.4.0-alpha.62"
resolved "https://registry.yarnpkg.com/@metadaoproject/futarchy/-/futarchy-0.4.0-alpha.62.tgz#399ecb2be2422b5be3614ce1ed412db4ccdd5999"
integrity sha512-qp2bjBabIelxGPw0FaLnd/F+EoCBwm4MefmyT6syR4YBXbe2IGEgu+XjUmBYMmjlR8BzEJ65s8XS4ZIJaIRUsA==
dependencies:
"@coral-xyz/anchor" "^0.29.0"
"@metaplex-foundation/umi" "^0.9.2"
Expand Down
Loading