@alpha-arcade/sdk 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/index.cjs +795 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +794 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -146,6 +146,19 @@ type ProposeMatchParams = {
|
|
|
146
146
|
/** Quantity to match in microunits */
|
|
147
147
|
quantityMatched: number;
|
|
148
148
|
};
|
|
149
|
+
/** Parameters for amending (editing) an existing unfilled order */
|
|
150
|
+
type AmendOrderParams = {
|
|
151
|
+
/** Market app ID */
|
|
152
|
+
marketAppId: number;
|
|
153
|
+
/** The escrow app ID of the order to amend */
|
|
154
|
+
escrowAppId: number;
|
|
155
|
+
/** New price in microunits (e.g. 500000 = $0.50) */
|
|
156
|
+
price: number;
|
|
157
|
+
/** New quantity in microunits (e.g. 1000000 = 1 share) */
|
|
158
|
+
quantity: number;
|
|
159
|
+
/** New slippage in microunits (default 0) */
|
|
160
|
+
slippage?: number;
|
|
161
|
+
};
|
|
149
162
|
/** A counterparty order to match against */
|
|
150
163
|
type CounterpartyMatch = {
|
|
151
164
|
/** Escrow app ID of the counterparty order */
|
|
@@ -188,6 +201,15 @@ type ProposeMatchResult = {
|
|
|
188
201
|
/** Confirmed round number */
|
|
189
202
|
confirmedRound: number;
|
|
190
203
|
};
|
|
204
|
+
/** Result of amending an order */
|
|
205
|
+
type AmendOrderResult = {
|
|
206
|
+
/** Whether the amendment succeeded */
|
|
207
|
+
success: boolean;
|
|
208
|
+
/** Transaction IDs */
|
|
209
|
+
txIds: string[];
|
|
210
|
+
/** Confirmed round number */
|
|
211
|
+
confirmedRound: number;
|
|
212
|
+
};
|
|
191
213
|
/** A single entry in the orderbook (one price level, one order) */
|
|
192
214
|
type OrderbookEntry = {
|
|
193
215
|
/** Price in microunits (e.g. 500000 = $0.50) */
|
|
@@ -400,6 +422,19 @@ declare class AlphaClient {
|
|
|
400
422
|
* @returns Whether the match succeeded
|
|
401
423
|
*/
|
|
402
424
|
proposeMatch(params: ProposeMatchParams): Promise<ProposeMatchResult>;
|
|
425
|
+
/**
|
|
426
|
+
* Amends (edits) an existing unfilled order in-place.
|
|
427
|
+
*
|
|
428
|
+
* Cheaper and faster than cancel + recreate. The escrow contract adjusts
|
|
429
|
+
* collateral automatically — sends you a refund if the new value is lower,
|
|
430
|
+
* or requires extra funds if higher.
|
|
431
|
+
*
|
|
432
|
+
* Only works on orders with zero quantity filled.
|
|
433
|
+
*
|
|
434
|
+
* @param params - Amend parameters (marketAppId, escrowAppId, price, quantity, slippage?)
|
|
435
|
+
* @returns Whether the amendment succeeded
|
|
436
|
+
*/
|
|
437
|
+
amendOrder(params: AmendOrderParams): Promise<AmendOrderResult>;
|
|
403
438
|
/**
|
|
404
439
|
* Splits USDC into equal amounts of YES and NO outcome tokens.
|
|
405
440
|
*
|
|
@@ -647,4 +682,4 @@ declare const getEscrowGlobalState: (indexerClient: algosdk.Indexer, escrowAppId
|
|
|
647
682
|
*/
|
|
648
683
|
declare const checkAssetOptIn: (algodClient: algosdk.Algodv2, address: string, assetId: number) => Promise<boolean>;
|
|
649
684
|
|
|
650
|
-
export { type AggregatedOrderbook, type AggregatedOrderbookEntry, type AggregatedOrderbookSide, AlphaClient, type AlphaClientConfig, type CancelOrderParams, type CancelOrderResult, type ClaimParams, type ClaimResult, type CounterpartyMatch, type CreateLimitOrderParams, type CreateMarketOrderParams, type CreateOrderResult, DEFAULT_API_BASE_URL, DEFAULT_MARKET_CREATOR_ADDRESS, type EscrowGlobalState, type Market, type MarketGlobalState, type MarketOption, type MergeSharesParams, type OpenOrder, type OrderSide, type Orderbook, type OrderbookEntry, type OrderbookSide, type Position, type ProposeMatchParams, type ProposeMatchResult, type SplitMergeResult, type SplitSharesParams, type WalletPosition, calculateFee, calculateFeeFromTotal, calculateMatchingOrders, checkAssetOptIn, decodeGlobalState, getEscrowGlobalState, getLiveMarketsFromApi, getMarketFromApi, getMarketGlobalState, getMarketOnChain, getMarketsOnChain };
|
|
685
|
+
export { type AggregatedOrderbook, type AggregatedOrderbookEntry, type AggregatedOrderbookSide, AlphaClient, type AlphaClientConfig, type AmendOrderParams, type AmendOrderResult, type CancelOrderParams, type CancelOrderResult, type ClaimParams, type ClaimResult, type CounterpartyMatch, type CreateLimitOrderParams, type CreateMarketOrderParams, type CreateOrderResult, DEFAULT_API_BASE_URL, DEFAULT_MARKET_CREATOR_ADDRESS, type EscrowGlobalState, type Market, type MarketGlobalState, type MarketOption, type MergeSharesParams, type OpenOrder, type OrderSide, type Orderbook, type OrderbookEntry, type OrderbookSide, type Position, type ProposeMatchParams, type ProposeMatchResult, type SplitMergeResult, type SplitSharesParams, type WalletPosition, calculateFee, calculateFeeFromTotal, calculateMatchingOrders, checkAssetOptIn, decodeGlobalState, getEscrowGlobalState, getLiveMarketsFromApi, getMarketFromApi, getMarketGlobalState, getMarketOnChain, getMarketsOnChain };
|
package/dist/index.d.ts
CHANGED
|
@@ -146,6 +146,19 @@ type ProposeMatchParams = {
|
|
|
146
146
|
/** Quantity to match in microunits */
|
|
147
147
|
quantityMatched: number;
|
|
148
148
|
};
|
|
149
|
+
/** Parameters for amending (editing) an existing unfilled order */
|
|
150
|
+
type AmendOrderParams = {
|
|
151
|
+
/** Market app ID */
|
|
152
|
+
marketAppId: number;
|
|
153
|
+
/** The escrow app ID of the order to amend */
|
|
154
|
+
escrowAppId: number;
|
|
155
|
+
/** New price in microunits (e.g. 500000 = $0.50) */
|
|
156
|
+
price: number;
|
|
157
|
+
/** New quantity in microunits (e.g. 1000000 = 1 share) */
|
|
158
|
+
quantity: number;
|
|
159
|
+
/** New slippage in microunits (default 0) */
|
|
160
|
+
slippage?: number;
|
|
161
|
+
};
|
|
149
162
|
/** A counterparty order to match against */
|
|
150
163
|
type CounterpartyMatch = {
|
|
151
164
|
/** Escrow app ID of the counterparty order */
|
|
@@ -188,6 +201,15 @@ type ProposeMatchResult = {
|
|
|
188
201
|
/** Confirmed round number */
|
|
189
202
|
confirmedRound: number;
|
|
190
203
|
};
|
|
204
|
+
/** Result of amending an order */
|
|
205
|
+
type AmendOrderResult = {
|
|
206
|
+
/** Whether the amendment succeeded */
|
|
207
|
+
success: boolean;
|
|
208
|
+
/** Transaction IDs */
|
|
209
|
+
txIds: string[];
|
|
210
|
+
/** Confirmed round number */
|
|
211
|
+
confirmedRound: number;
|
|
212
|
+
};
|
|
191
213
|
/** A single entry in the orderbook (one price level, one order) */
|
|
192
214
|
type OrderbookEntry = {
|
|
193
215
|
/** Price in microunits (e.g. 500000 = $0.50) */
|
|
@@ -400,6 +422,19 @@ declare class AlphaClient {
|
|
|
400
422
|
* @returns Whether the match succeeded
|
|
401
423
|
*/
|
|
402
424
|
proposeMatch(params: ProposeMatchParams): Promise<ProposeMatchResult>;
|
|
425
|
+
/**
|
|
426
|
+
* Amends (edits) an existing unfilled order in-place.
|
|
427
|
+
*
|
|
428
|
+
* Cheaper and faster than cancel + recreate. The escrow contract adjusts
|
|
429
|
+
* collateral automatically — sends you a refund if the new value is lower,
|
|
430
|
+
* or requires extra funds if higher.
|
|
431
|
+
*
|
|
432
|
+
* Only works on orders with zero quantity filled.
|
|
433
|
+
*
|
|
434
|
+
* @param params - Amend parameters (marketAppId, escrowAppId, price, quantity, slippage?)
|
|
435
|
+
* @returns Whether the amendment succeeded
|
|
436
|
+
*/
|
|
437
|
+
amendOrder(params: AmendOrderParams): Promise<AmendOrderResult>;
|
|
403
438
|
/**
|
|
404
439
|
* Splits USDC into equal amounts of YES and NO outcome tokens.
|
|
405
440
|
*
|
|
@@ -647,4 +682,4 @@ declare const getEscrowGlobalState: (indexerClient: algosdk.Indexer, escrowAppId
|
|
|
647
682
|
*/
|
|
648
683
|
declare const checkAssetOptIn: (algodClient: algosdk.Algodv2, address: string, assetId: number) => Promise<boolean>;
|
|
649
684
|
|
|
650
|
-
export { type AggregatedOrderbook, type AggregatedOrderbookEntry, type AggregatedOrderbookSide, AlphaClient, type AlphaClientConfig, type CancelOrderParams, type CancelOrderResult, type ClaimParams, type ClaimResult, type CounterpartyMatch, type CreateLimitOrderParams, type CreateMarketOrderParams, type CreateOrderResult, DEFAULT_API_BASE_URL, DEFAULT_MARKET_CREATOR_ADDRESS, type EscrowGlobalState, type Market, type MarketGlobalState, type MarketOption, type MergeSharesParams, type OpenOrder, type OrderSide, type Orderbook, type OrderbookEntry, type OrderbookSide, type Position, type ProposeMatchParams, type ProposeMatchResult, type SplitMergeResult, type SplitSharesParams, type WalletPosition, calculateFee, calculateFeeFromTotal, calculateMatchingOrders, checkAssetOptIn, decodeGlobalState, getEscrowGlobalState, getLiveMarketsFromApi, getMarketFromApi, getMarketGlobalState, getMarketOnChain, getMarketsOnChain };
|
|
685
|
+
export { type AggregatedOrderbook, type AggregatedOrderbookEntry, type AggregatedOrderbookSide, AlphaClient, type AlphaClientConfig, type AmendOrderParams, type AmendOrderResult, type CancelOrderParams, type CancelOrderResult, type ClaimParams, type ClaimResult, type CounterpartyMatch, type CreateLimitOrderParams, type CreateMarketOrderParams, type CreateOrderResult, DEFAULT_API_BASE_URL, DEFAULT_MARKET_CREATOR_ADDRESS, type EscrowGlobalState, type Market, type MarketGlobalState, type MarketOption, type MergeSharesParams, type OpenOrder, type OrderSide, type Orderbook, type OrderbookEntry, type OrderbookSide, type Position, type ProposeMatchParams, type ProposeMatchResult, type SplitMergeResult, type SplitSharesParams, type WalletPosition, calculateFee, calculateFeeFromTotal, calculateMatchingOrders, checkAssetOptIn, decodeGlobalState, getEscrowGlobalState, getLiveMarketsFromApi, getMarketFromApi, getMarketGlobalState, getMarketOnChain, getMarketsOnChain };
|