@renec-foundation/escrow-sdk
Advanced tools
Comparing version 7.0.4-alpha to 7.0.5-alpha
@@ -26,3 +26,3 @@ /// <reference types="bn.js" /> | ||
setUsdRate(tradeConfigAuthority: PublicKey, usdRate: BN): Promise<TransactionBuilder>; | ||
setMinmumOfferSize(tradeConfigAuthority: PublicKey, minimumOfferSize: BN): Promise<TransactionBuilder>; | ||
setMinimumOfferSize(tradeConfigAuthority: PublicKey, minimumOfferSize: BN): Promise<TransactionBuilder>; | ||
removeArbitratorCert(tradeConfigAuthority: PublicKey, arbitratorAuthority: PublicKey): Promise<TransactionBuilder>; | ||
@@ -29,0 +29,0 @@ updateMarketState(tradeConfigAuthority: PublicKey, option: ConfigOptionParams): Promise<TransactionBuilder>; |
@@ -80,3 +80,3 @@ "use strict"; | ||
marketAccount: this.publicKey, | ||
deployerPubkey: deployerPubkey, | ||
deployerPubkey, | ||
newTradeConfigAuthority, | ||
@@ -91,3 +91,3 @@ })).toTx(); | ||
marketAccount: this.publicKey, | ||
deployerPubkey: deployerPubkey, | ||
deployerPubkey, | ||
newAmlPolicyAuthority, | ||
@@ -154,3 +154,3 @@ })).toTx(); | ||
} | ||
setMinmumOfferSize(tradeConfigAuthority, minimumOfferSize) { | ||
setMinimumOfferSize(tradeConfigAuthority, minimumOfferSize) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -182,3 +182,3 @@ const tx = (yield this.ctx.ixs.setMinimumOfferSize({ | ||
marketAccount: this.publicKey, | ||
tradeConfigAuthority: tradeConfigAuthority, | ||
tradeConfigAuthority, | ||
treasuryPubkey, | ||
@@ -207,3 +207,3 @@ bondSize, | ||
marketAccount: this.publicKey, | ||
marketNativeVault: marketNativeVault, | ||
marketNativeVault, | ||
caller: amlPolicyAuthority, | ||
@@ -322,6 +322,6 @@ user, | ||
transactionQuantity: Math.ceil(tradeIds.length / matching_1.MAX_TRADE_PER_TRANSACTION), | ||
remainingAccounts: remainingAccounts, | ||
tradeIds: tradeIds, | ||
tradeAmounts: tradeAmounts, | ||
bumps: bumps, | ||
remainingAccounts, | ||
tradeIds, | ||
tradeAmounts, | ||
bumps, | ||
rates, | ||
@@ -346,6 +346,6 @@ }; | ||
const initProfileIx = (yield this.ctx.ixs.initProfileIx({ | ||
marketAccount: marketAccount, | ||
marketNativeVault: marketNativeVault, | ||
marketAccount, | ||
marketNativeVault, | ||
caller: user, | ||
user: user, | ||
user, | ||
tokenMint: this.data.tokenMint, | ||
@@ -363,6 +363,6 @@ profilePubkey: userProfilePda.key, | ||
? (yield this.ctx.ixs.matchingEngineWithBuyOfferIx({ | ||
configAccount: configAccount, | ||
marketAccount: marketAccount, | ||
marketTokenVault: marketTokenVault, | ||
marketNativeVault: marketNativeVault, | ||
configAccount, | ||
marketAccount, | ||
marketTokenVault, | ||
marketNativeVault, | ||
profile: userProfilePda.key, | ||
@@ -384,6 +384,6 @@ user, | ||
: (yield this.ctx.ixs.matchingEngineIx({ | ||
configAccount: configAccount, | ||
marketAccount: marketAccount, | ||
marketTokenVault: marketTokenVault, | ||
marketNativeVault: marketNativeVault, | ||
configAccount, | ||
marketAccount, | ||
marketTokenVault, | ||
marketNativeVault, | ||
profile: userProfilePda.key, | ||
@@ -447,5 +447,5 @@ user, | ||
offerQuantity: tradeIds.length, | ||
tradeIds: tradeIds, | ||
bumps: bumps, | ||
remainingAccounts: remainingAccounts, | ||
tradeIds, | ||
bumps, | ||
remainingAccounts, | ||
rates, | ||
@@ -511,6 +511,6 @@ }; | ||
const initProfileIx = (yield this.ctx.ixs.initProfileIx({ | ||
marketAccount: marketAccount, | ||
marketNativeVault: marketNativeVault, | ||
marketAccount, | ||
marketNativeVault, | ||
caller: user, | ||
user: user, | ||
user, | ||
tokenMint: this.data.tokenMint, | ||
@@ -528,6 +528,6 @@ profilePubkey: userProfilePda.key, | ||
? (yield this.ctx.ixs.matchingEngineWithBuyOfferIx({ | ||
configAccount: configAccount, | ||
marketAccount: marketAccount, | ||
marketTokenVault: marketTokenVault, | ||
marketNativeVault: marketNativeVault, | ||
configAccount, | ||
marketAccount, | ||
marketTokenVault, | ||
marketNativeVault, | ||
profile: userProfilePda.key, | ||
@@ -543,3 +543,3 @@ user, | ||
bumps: [tradePDA.bump], | ||
remainingAccounts: remainingAccounts, | ||
remainingAccounts, | ||
takerBondType, | ||
@@ -550,6 +550,6 @@ })) | ||
: (yield this.ctx.ixs.matchingEngineIx({ | ||
configAccount: configAccount, | ||
marketAccount: marketAccount, | ||
marketTokenVault: marketTokenVault, | ||
marketNativeVault: marketNativeVault, | ||
configAccount, | ||
marketAccount, | ||
marketTokenVault, | ||
marketNativeVault, | ||
profile: userProfilePda.key, | ||
@@ -565,3 +565,3 @@ user, | ||
bumps: [tradePDA.bump], | ||
remainingAccounts: remainingAccounts, | ||
remainingAccounts, | ||
takerBondType, | ||
@@ -568,0 +568,0 @@ })) |
@@ -81,3 +81,3 @@ "use strict"; | ||
} | ||
let remainingAccounts = (0, __1.getRemaningAccounts)([]); | ||
let remainingAccounts = (0, __1.getRemainingAccounts)([]); | ||
// Get or create default joiner profile | ||
@@ -88,3 +88,3 @@ const userProfilePda = pda.getProfilePDA(maker, tokenMint); | ||
const initProfileIx = (yield ctx.ixs.initProfileIx({ | ||
marketAccount: marketAccount, | ||
marketAccount, | ||
marketNativeVault: marketNativeAccount, | ||
@@ -104,8 +104,8 @@ caller: maker, | ||
const tx = (yield ctx.ixs.makeOfferIx({ | ||
configAccount: configAccount, | ||
marketAccount: marketAccount, | ||
configAccount, | ||
marketAccount, | ||
marketTokenVault: marketTokenAccount, | ||
marketNativeVault: marketNativeAccount, | ||
side: side, | ||
bondType: bondType, | ||
side, | ||
bondType, | ||
offerPDA, | ||
@@ -117,3 +117,3 @@ tokenMint, | ||
minTradeSize, | ||
tokenAmount: tokenAmount, | ||
tokenAmount, | ||
rate: (0, __1.scale)(rate, __1.SCALE_EXPO), | ||
@@ -150,3 +150,3 @@ fiatCurrency, | ||
let prependIxs = []; | ||
let remainingAccounts = (0, __1.getRemaningAccounts)([]); | ||
let remainingAccounts = (0, __1.getRemainingAccounts)([]); | ||
// Get or create default joiner profile | ||
@@ -157,3 +157,3 @@ const userProfilePda = pda.getProfilePDA(maker, tokenMint); | ||
const initProfileIx = (yield ctx.ixs.initProfileIx({ | ||
marketAccount: marketAccount, | ||
marketAccount, | ||
marketNativeVault: marketNativeAccount, | ||
@@ -173,8 +173,8 @@ caller: maker, | ||
const tx = (yield ctx.ixs.makeOfferOracleIx({ | ||
configAccount: configAccount, | ||
marketAccount: marketAccount, | ||
configAccount, | ||
marketAccount, | ||
marketTokenVault: marketTokenAccount, | ||
marketNativeVault: marketNativeAccount, | ||
side: side, | ||
bondType: bondType, | ||
side, | ||
bondType, | ||
offerPDA, | ||
@@ -186,3 +186,3 @@ tokenMint, | ||
minTradeSize, | ||
tokenAmount: tokenAmount, | ||
tokenAmount, | ||
rate: (0, __1.scale)(rate, __1.SCALE_EXPO), | ||
@@ -210,9 +210,9 @@ fiatCurrency, | ||
const makerTokenAccount = yield (0, common_sdk_1.deriveATA)(maker, tokenMint); | ||
let remainingAccounts = (0, __1.getRemaningAccounts)([]); | ||
let remainingAccounts = (0, __1.getRemainingAccounts)([]); | ||
if ((0, lodash_1.isEqual)(this.data.side, types_1.TradeSide.Buy)) { | ||
let buyerProfile = this.pda.getProfilePDA(maker, tokenMint); | ||
remainingAccounts = (0, __1.getRemaningAccounts)([buyerProfile.key]); | ||
remainingAccounts = (0, __1.getRemainingAccounts)([buyerProfile.key]); | ||
} | ||
const tx = (yield this.ctx.ixs.cancelOfferIx({ | ||
marketAccount: marketAccount, | ||
marketAccount, | ||
marketTokenVault: marketTokenAccount, | ||
@@ -237,9 +237,9 @@ marketNativeVault: marketNativeAccount, | ||
const makerTokenAccount = yield (0, common_sdk_1.deriveATA)(maker, tokenMint); | ||
let remainingAccounts = (0, __1.getRemaningAccounts)([]); | ||
let remainingAccounts = (0, __1.getRemainingAccounts)([]); | ||
if ((0, lodash_1.isEqual)(this.data.side, types_1.TradeSide.Buy)) { | ||
let buyerProfile = this.pda.getProfilePDA(maker, tokenMint); | ||
remainingAccounts = (0, __1.getRemaningAccounts)([buyerProfile.key]); | ||
remainingAccounts = (0, __1.getRemainingAccounts)([buyerProfile.key]); | ||
} | ||
const tx = (yield this.ctx.ixs.redeemOfferIx({ | ||
marketAccount: marketAccount, | ||
marketAccount, | ||
marketTokenVault: marketTokenAccount, | ||
@@ -246,0 +246,0 @@ marketNativeVault: marketNativeAccount, |
@@ -13,3 +13,3 @@ /// <reference types="bn.js" /> | ||
configId: string; | ||
constructor(ctx: EscrowContext, publicKey: PublicKey, data: TradeData, pda: PDA, configid: string); | ||
constructor(ctx: EscrowContext, publicKey: PublicKey, data: TradeData, pda: PDA, configId: string); | ||
static getTrade(ctx: EscrowContext, configId: string, marketId: string, tradeId: BN): Promise<TradeClient>; | ||
@@ -16,0 +16,0 @@ getEvidenceAccount(ctx: EscrowContext, user: PublicKey): Promise<EvidenceAccountData>; |
@@ -30,3 +30,3 @@ "use strict"; | ||
class TradeClient { | ||
constructor(ctx, publicKey, data, pda, configid) { | ||
constructor(ctx, publicKey, data, pda, configId) { | ||
this.ctx = ctx; | ||
@@ -36,3 +36,3 @@ this.data = data; | ||
this.pda = pda; | ||
this.configId = configid; | ||
this.configId = configId; | ||
} | ||
@@ -110,3 +110,3 @@ static getTrade(ctx, configId, marketId, tradeId) { | ||
trade: this.publicKey, | ||
caller: caller, | ||
caller, | ||
})).toTx(); | ||
@@ -127,10 +127,10 @@ return tx; | ||
const _d = yield (0, common_sdk_1.resolveOrCreateATA)(this.ctx.connection, marketStateData.treasuryPubkey, this.data.tokenMint, () => this.ctx.fetcher.getTokenAccountRentExempt(), undefined, arbitrator), { address: treasuryTokenAccount } = _d, createTreasuryTokenAccountInstruction = __rest(_d, ["address"]); | ||
let remainingAccounts = (0, __1.getRemaningAccounts)([]); | ||
let remainingAccounts = (0, __1.getRemainingAccounts)([]); | ||
if ((0, lodash_1.isEqual)(disputeAction, types_2.DisputeAction.Cancel)) { | ||
let buyerProfile = this.pda.getProfilePDA(this.data.buyerAuthority, tokenMint); | ||
remainingAccounts = (0, __1.getRemaningAccounts)([buyerProfile.key]); | ||
remainingAccounts = (0, __1.getRemainingAccounts)([buyerProfile.key]); | ||
} | ||
else if ((0, lodash_1.isEqual)(disputeAction, types_2.DisputeAction.Release)) { | ||
let sellerProfile = this.pda.getProfilePDA(this.data.sellerAuthority, tokenMint); | ||
remainingAccounts = (0, __1.getRemaningAccounts)([sellerProfile.key]); | ||
remainingAccounts = (0, __1.getRemainingAccounts)([sellerProfile.key]); | ||
} | ||
@@ -164,9 +164,9 @@ if (!this.data.buyOfferId.isZero()) { | ||
arbitratorAuthority: arbitrator, | ||
treasuryTokenAccount: treasuryTokenAccount, | ||
treasuryTokenAccount, | ||
arbitratorCert: this.pda.getArbitratorCertPDA(arbitrator, tokenMint).key, | ||
arbitratorTokenAccount: arbitratorTokenAccount, | ||
arbitratorTokenAccount, | ||
seller: this.data.sellerAuthority, | ||
sellerTokenAccount: sellerTokenAccount, | ||
sellerTokenAccount, | ||
buyer: this.data.buyerAuthority, | ||
buyerTokenAccount: buyerTokenAccount, | ||
buyerTokenAccount, | ||
remainingAccounts, | ||
@@ -196,10 +196,10 @@ })) | ||
const _b = yield (0, common_sdk_1.resolveOrCreateATA)(this.ctx.connection, taker, tokenMint, () => this.ctx.fetcher.getTokenAccountRentExempt(), undefined, taker), { address: takerTokenAccount } = _b, createTakerTokenAccountInstruction = __rest(_b, ["address"]); | ||
let remainingAccounts = (0, __1.getRemaningAccounts)([]); | ||
let remainingAccounts = (0, __1.getRemainingAccounts)([]); | ||
if (!this.data.buyOfferId.isZero()) { | ||
const buyOfferAccount = this.pda.getOfferPDA(this.data.buyOfferId).key; | ||
remainingAccounts = (0, __1.getRemaningAccounts)([buyOfferAccount]); | ||
remainingAccounts = (0, __1.getRemainingAccounts)([buyOfferAccount]); | ||
} | ||
let takerProfilePubkey = this.pda.getProfilePDA(taker, tokenMint).key; | ||
const tx = (yield this.ctx.ixs.cancelTradeIx({ | ||
marketAccount: marketAccount, | ||
marketAccount, | ||
marketTokenVault: marketTokenAccount, | ||
@@ -211,5 +211,5 @@ marketNativeVault: marketNativeAccount, | ||
treasuryAuthority: marketStateData.treasuryPubkey, | ||
treasuryTokenAccount: treasuryTokenAccount, | ||
taker: taker, | ||
takerTokenAccount: takerTokenAccount, | ||
treasuryTokenAccount, | ||
taker, | ||
takerTokenAccount, | ||
remainingAccounts, | ||
@@ -232,5 +232,5 @@ })) | ||
evidencePDA: this.pda.getEvidencePDA(buyer, this.publicKey), | ||
sellerData: sellerData, | ||
arbitratordata: arbitratorData, | ||
nonce: nonce, | ||
sellerData, | ||
arbitratorData, | ||
nonce, | ||
tradeAccount: this.publicKey, | ||
@@ -237,0 +237,0 @@ user: buyer, |
@@ -5,3 +5,3 @@ export * from "./initialize-market-ix"; | ||
export * from "./resolve-dispute-ix"; | ||
export * from "./set-aml-policy-authoirty-ix"; | ||
export * from "./set-aml-policy-authority-ix"; | ||
export * from "./set-trade-config-authority-ix"; | ||
@@ -8,0 +8,0 @@ export * from "./add-arbitrator-cert-ix"; |
@@ -21,3 +21,3 @@ "use strict"; | ||
__exportStar(require("./resolve-dispute-ix"), exports); | ||
__exportStar(require("./set-aml-policy-authoirty-ix"), exports); | ||
__exportStar(require("./set-aml-policy-authority-ix"), exports); | ||
__exportStar(require("./set-trade-config-authority-ix"), exports); | ||
@@ -24,0 +24,0 @@ __exportStar(require("./add-arbitrator-cert-ix"), exports); |
@@ -11,3 +11,3 @@ import { Instruction } from "@orca-so/common-sdk"; | ||
sellerData: string; | ||
arbitratordata: string; | ||
arbitratorData: string; | ||
nonce: string; | ||
@@ -14,0 +14,0 @@ tradeAccount: PublicKey; |
@@ -16,5 +16,5 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { marketAccount, marketNativeVault, evidencePDA, sellerData, arbitratordata, nonce, tradeAccount, user, } = params; | ||
const { marketAccount, marketNativeVault, evidencePDA, sellerData, arbitratorData, nonce, tradeAccount, user, } = params; | ||
const ix = yield program.methods | ||
.savePaymentEvidence(sellerData, arbitratordata, nonce, evidencePDA.bump) | ||
.savePaymentEvidence(sellerData, arbitratorData, nonce, evidencePDA.bump) | ||
.accounts({ | ||
@@ -21,0 +21,0 @@ marketAccount, |
@@ -49,3 +49,3 @@ /// <reference types="bn.js" /> | ||
/** | ||
* @dev @maket_instance can be find, based on the combination of config and token mint | ||
* @dev @market_instance can be find, based on the combination of config and token mint | ||
* @param offerInfo: Should contain which Version we are | ||
@@ -52,0 +52,0 @@ */ |
@@ -39,3 +39,3 @@ "use strict"; | ||
if (!curve25519PublicKey_receiver) { | ||
throw new Error(`Error conver publickey`); | ||
throw new Error(`Error convert publickey`); | ||
} | ||
@@ -51,3 +51,3 @@ const messageUint8 = Buffer.from(message); | ||
if (!curve25519PublicKey_sender) { | ||
throw new Error(`Error conver publickey`); | ||
throw new Error(`Error convert publickey`); | ||
} | ||
@@ -54,0 +54,0 @@ const nonceUint8 = Uint8Array.from(bytes_1.bs58.decode(nonce)); |
@@ -18,3 +18,3 @@ import Decimal from "decimal.js"; | ||
export declare const getTokenRateOverUsd: (tokenRateInUsd: u64) => Decimal; | ||
export declare const getRemaningAccounts: (accounts: PublicKey[]) => AccountMeta[]; | ||
export declare const getRemainingAccounts: (accounts: PublicKey[]) => AccountMeta[]; | ||
export declare const scale: (number: number, expo: number) => BN; | ||
@@ -21,0 +21,0 @@ export declare const unScale: (scaledNumber: BN, expo: number) => number; |
@@ -20,3 +20,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getFiatAmountFromUiTokenAmount = exports.getTokenAmountFromUiFiatAmount = exports.unScale = exports.scale = exports.getRemaningAccounts = exports.getTokenRateOverUsd = exports.getUsdRate = exports.getTokenRateOverRenec = exports.getRenecRate = exports.DEFAULT_EXPO = exports.DENOMINATOR = void 0; | ||
exports.getFiatAmountFromUiTokenAmount = exports.getTokenAmountFromUiFiatAmount = exports.unScale = exports.scale = exports.getRemainingAccounts = exports.getTokenRateOverUsd = exports.getUsdRate = exports.getTokenRateOverRenec = exports.getRenecRate = exports.DEFAULT_EXPO = exports.DENOMINATOR = void 0; | ||
const decimal_js_1 = __importDefault(require("decimal.js")); | ||
@@ -54,3 +54,3 @@ const common_sdk_1 = require("@orca-so/common-sdk"); | ||
exports.getTokenRateOverUsd = getTokenRateOverUsd; | ||
const getRemaningAccounts = (accounts) => { | ||
const getRemainingAccounts = (accounts) => { | ||
let remainingAccounts = []; | ||
@@ -66,3 +66,3 @@ for (let i = 0; i < accounts.length; i++) { | ||
}; | ||
exports.getRemaningAccounts = getRemaningAccounts; | ||
exports.getRemainingAccounts = getRemainingAccounts; | ||
const scale = (number, expo) => { | ||
@@ -69,0 +69,0 @@ return common_sdk_1.DecimalUtil.toU64(new decimal_js_1.default(number), expo); |
{ | ||
"name": "@renec-foundation/escrow-sdk", | ||
"version": "7.0.4-alpha", | ||
"version": "7.0.5-alpha", | ||
"description": "Typescript SDK to interact with Escrow program.", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is not supported yet
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
579625
133
13755