@accessprotocol/js
Advanced tools
Comparing version 2.0.0-alpha.1 to 2.0.0-alpha.2
@@ -42,3 +42,3 @@ "use strict"; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
const state_1 = require("./state"); | ||
const state_js_1 = require("./state.js"); | ||
const BN = __importStar(require("bn.js")); | ||
@@ -56,9 +56,9 @@ const spl_token_1 = require("@solana/spl-token"); | ||
*/ | ||
const claimBond = (connection, bondAccount, buyer, quoteTokenSource, programId = state_1.ACCESS_PROGRAM_ID) => __awaiter(void 0, void 0, void 0, function* () { | ||
const bond = yield state_1.BondAccount.retrieve(connection, bondAccount); | ||
const stakePool = yield state_1.StakePool.retrieve(connection, bond.stakePool); | ||
const [centralStateKey] = state_1.CentralStateV2.getKey(programId); | ||
let tokenMint = state_1.ACCESS_MINT; | ||
if (programId !== state_1.ACCESS_PROGRAM_ID) { | ||
tokenMint = (yield state_1.CentralStateV2.retrieve(connection, centralStateKey)).tokenMint; | ||
const claimBond = (connection, bondAccount, buyer, quoteTokenSource, programId = state_js_1.ACCESS_PROGRAM_ID) => __awaiter(void 0, void 0, void 0, function* () { | ||
const bond = yield state_js_1.BondAccount.retrieve(connection, bondAccount); | ||
const stakePool = yield state_js_1.StakePool.retrieve(connection, bond.stakePool); | ||
const [centralStateKey] = state_js_1.CentralStateV2.getKey(programId); | ||
let tokenMint = state_js_1.ACCESS_MINT; | ||
if (programId !== state_js_1.ACCESS_PROGRAM_ID) { | ||
tokenMint = (yield state_js_1.CentralStateV2.retrieve(connection, centralStateKey)).tokenMint; | ||
} | ||
@@ -76,5 +76,5 @@ return new raw_instructions_js_1.claimBondInstruction().getInstruction(programId, bondAccount, buyer, quoteTokenSource, bond.sellerTokenAccount, bond.stakePool, tokenMint, stakePool.vault, centralStateKey, spl_token_1.TOKEN_PROGRAM_ID); | ||
*/ | ||
const closeStakeAccount = (connection, stakeAccount, programId = state_1.ACCESS_PROGRAM_ID) => __awaiter(void 0, void 0, void 0, function* () { | ||
const stake = yield state_1.StakeAccount.retrieve(connection, stakeAccount); | ||
const [centralStateKey] = state_1.CentralStateV2.getKey(programId); | ||
const closeStakeAccount = (connection, stakeAccount, programId = state_js_1.ACCESS_PROGRAM_ID) => __awaiter(void 0, void 0, void 0, function* () { | ||
const stake = yield state_js_1.StakeAccount.retrieve(connection, stakeAccount); | ||
const [centralStateKey] = state_js_1.CentralStateV2.getKey(programId); | ||
return new raw_instructions_js_1.closeStakeAccountInstruction().getInstruction(programId, stakeAccount, stake.owner, centralStateKey); | ||
@@ -91,5 +91,5 @@ }); | ||
*/ | ||
const closeStakePool = (connection, stakePoolAccount, programId = state_1.ACCESS_PROGRAM_ID) => __awaiter(void 0, void 0, void 0, function* () { | ||
const stakePool = yield state_1.StakePool.retrieve(connection, stakePoolAccount); | ||
const [centralStateKey] = state_1.CentralStateV2.getKey(programId); | ||
const closeStakePool = (connection, stakePoolAccount, programId = state_js_1.ACCESS_PROGRAM_ID) => __awaiter(void 0, void 0, void 0, function* () { | ||
const stakePool = yield state_js_1.StakePool.retrieve(connection, stakePoolAccount); | ||
const [centralStateKey] = state_js_1.CentralStateV2.getKey(programId); | ||
return new raw_instructions_js_1.closeStakePoolInstruction().getInstruction(programId, stakePoolAccount, stakePool.vault, stakePool.owner, centralStateKey); | ||
@@ -115,5 +115,5 @@ }); | ||
*/ | ||
const createBond = (seller, buyer, totalAmountSold, totalQuoteAmount, quoteMint, sellerTokenAccount, unlockStartDate, unlockPeriod, unlockAmount, stakePool, sellerIndex, programId = state_1.ACCESS_PROGRAM_ID) => { | ||
const [bondAccount] = state_1.BondAccount.getKey(programId, buyer, totalAmountSold); | ||
const [centralStateKey] = state_1.CentralStateV2.getKey(programId); | ||
const createBond = (seller, buyer, totalAmountSold, totalQuoteAmount, quoteMint, sellerTokenAccount, unlockStartDate, unlockPeriod, unlockAmount, stakePool, sellerIndex, programId = state_js_1.ACCESS_PROGRAM_ID) => { | ||
const [bondAccount] = state_js_1.BondAccount.getKey(programId, buyer, totalAmountSold); | ||
const [centralStateKey] = state_js_1.CentralStateV2.getKey(programId); | ||
return new raw_instructions_js_1.createBondInstruction({ | ||
@@ -141,4 +141,4 @@ buyer: buyer.toBuffer(), | ||
*/ | ||
const signBond = (sellerIndex, seller, bondAccount, programId = state_1.ACCESS_PROGRAM_ID) => { | ||
const [centralStateKey] = state_1.CentralStateV2.getKey(programId); | ||
const signBond = (sellerIndex, seller, bondAccount, programId = state_js_1.ACCESS_PROGRAM_ID) => { | ||
const [centralStateKey] = state_js_1.CentralStateV2.getKey(programId); | ||
return new raw_instructions_js_1.signBondInstruction({ | ||
@@ -158,5 +158,5 @@ sellerIndex: new BN.BN(sellerIndex), | ||
*/ | ||
const adminMint = (connection, amount, destinationToken, programId = state_1.ACCESS_PROGRAM_ID) => __awaiter(void 0, void 0, void 0, function* () { | ||
const [centralKey] = state_1.CentralStateV2.getKey(programId); | ||
const centralState = yield state_1.CentralStateV2.retrieve(connection, centralKey); | ||
const adminMint = (connection, amount, destinationToken, programId = state_js_1.ACCESS_PROGRAM_ID) => __awaiter(void 0, void 0, void 0, function* () { | ||
const [centralKey] = state_js_1.CentralStateV2.getKey(programId); | ||
const centralState = yield state_js_1.CentralStateV2.retrieve(connection, centralKey); | ||
return new raw_instructions_js_1.adminMintInstruction({ | ||
@@ -175,7 +175,7 @@ amount: new BN.BN(amount), | ||
*/ | ||
const adminFreeze = (connection, accountToFreeze, programId = state_1.ACCESS_PROGRAM_ID) => __awaiter(void 0, void 0, void 0, function* () { | ||
const [centralKey] = state_1.CentralStateV2.getKey(programId); | ||
const centralState = yield state_1.CentralStateV2.retrieve(connection, centralKey); | ||
const adminFreeze = (connection, accountToFreeze, programId = state_js_1.ACCESS_PROGRAM_ID) => __awaiter(void 0, void 0, void 0, function* () { | ||
const [centralKey] = state_js_1.CentralStateV2.getKey(programId); | ||
const centralState = yield state_js_1.CentralStateV2.retrieve(connection, centralKey); | ||
return new raw_instructions_js_1.adminFreezeInstruction().getInstruction(programId, centralState.authority, accountToFreeze, centralKey); | ||
}); | ||
exports.adminFreeze = adminFreeze; |
@@ -16,3 +16,3 @@ /** | ||
import { SystemProgram } from "@solana/web3.js"; | ||
import { ACCESS_MINT, ACCESS_PROGRAM_ID, BondAccount, CentralStateV2, StakeAccount, StakePool } from "./state"; | ||
import { ACCESS_MINT, ACCESS_PROGRAM_ID, BondAccount, CentralStateV2, StakeAccount, StakePool } from "./state.js"; | ||
import * as BN from 'bn.js'; | ||
@@ -19,0 +19,0 @@ import { TOKEN_PROGRAM_ID, } from "@solana/spl-token"; |
{ | ||
"name": "@accessprotocol/js", | ||
"version": "2.0.0-alpha.1", | ||
"version": "2.0.0-alpha.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "type": "module", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
239075