mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-06-02 15:11:29 +00:00
fixes and renames
This commit is contained in:
@@ -2,60 +2,58 @@ import {
|
||||
CREATE_CPMM_POOL_FEE_ACC,
|
||||
CREATE_CPMM_POOL_PROGRAM,
|
||||
Raydium,
|
||||
TxVersion
|
||||
} from '@raydium-io/raydium-sdk-v2'
|
||||
import { MintLayout } from '@solana/spl-token'
|
||||
import { PublicKey } from '@solana/web3.js'
|
||||
import BN from 'bn.js'
|
||||
import { SolanaAgentKit } from '../agent'
|
||||
TxVersion,
|
||||
} from "@raydium-io/raydium-sdk-v2";
|
||||
import { MintLayout } from "@solana/spl-token";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import BN from "bn.js";
|
||||
import { SolanaAgent } from "../index";
|
||||
|
||||
export async function raydiumCreateCpmm(
|
||||
agent: SolanaAgentKit,
|
||||
|
||||
agent: SolanaAgent,
|
||||
mintA: PublicKey,
|
||||
mintB: PublicKey,
|
||||
|
||||
configId: PublicKey,
|
||||
|
||||
mintAAmount: BN,
|
||||
mintBAmount: BN,
|
||||
|
||||
startTime: BN,
|
||||
): Promise<string> {
|
||||
|
||||
const raydium = await Raydium.load({
|
||||
owner: agent.wallet,
|
||||
connection: agent.connection,
|
||||
})
|
||||
});
|
||||
|
||||
const [mintInfoA, mintInfoB] = await agent.connection.getMultipleAccountsInfo([mintA, mintB])
|
||||
if (mintInfoA === null || mintInfoB === null) throw Error('fetch mint info error')
|
||||
const [mintInfoA, mintInfoB] = await agent.connection.getMultipleAccountsInfo(
|
||||
[mintA, mintB],
|
||||
);
|
||||
if (mintInfoA === null || mintInfoB === null)
|
||||
throw Error("fetch mint info error");
|
||||
|
||||
const mintDecodeInfoA = MintLayout.decode(mintInfoA.data)
|
||||
const mintDecodeInfoB = MintLayout.decode(mintInfoB.data)
|
||||
const mintDecodeInfoA = MintLayout.decode(mintInfoA.data);
|
||||
const mintDecodeInfoB = MintLayout.decode(mintInfoB.data);
|
||||
|
||||
const mintFormatInfoA = {
|
||||
chainId: 101,
|
||||
address: mintA.toString(),
|
||||
programId: mintInfoA.owner.toString(),
|
||||
logoURI: '',
|
||||
symbol: '',
|
||||
name: '',
|
||||
logoURI: "",
|
||||
symbol: "",
|
||||
name: "",
|
||||
decimals: mintDecodeInfoA.decimals,
|
||||
tags: [],
|
||||
extensions: {}
|
||||
}
|
||||
extensions: {},
|
||||
};
|
||||
const mintFormatInfoB = {
|
||||
chainId: 101,
|
||||
address: mintB.toString(),
|
||||
programId: mintInfoB.owner.toString(),
|
||||
logoURI: '',
|
||||
symbol: '',
|
||||
name: '',
|
||||
logoURI: "",
|
||||
symbol: "",
|
||||
name: "",
|
||||
decimals: mintDecodeInfoB.decimals,
|
||||
tags: [],
|
||||
extensions: {}
|
||||
}
|
||||
extensions: {},
|
||||
};
|
||||
|
||||
const { execute, extInfo } = await raydium.cpmm.createPool({
|
||||
programId: CREATE_CPMM_POOL_PROGRAM,
|
||||
@@ -76,9 +74,9 @@ export async function raydiumCreateCpmm(
|
||||
// units: 600000,
|
||||
// microLamports: 46591500,
|
||||
// },
|
||||
})
|
||||
});
|
||||
|
||||
const { txId } = await execute({ sendAndConfirm: true })
|
||||
const { txId } = await execute({ sendAndConfirm: true });
|
||||
|
||||
return txId
|
||||
return txId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user