alex-sdk
Advanced tools
Comparing version 0.1.22 to 0.1.23
@@ -62,2 +62,14 @@ export declare const configs: { | ||
}; | ||
"token-abtc": { | ||
decimals: number; | ||
assetIdentifier: string; | ||
}; | ||
"token-slunr": { | ||
decimals: number; | ||
assetIdentifier: string; | ||
}; | ||
"brc20-chax": { | ||
decimals: number; | ||
assetIdentifier: string; | ||
}; | ||
}; | ||
@@ -64,0 +76,0 @@ SPONSORED_TX_EXECUTOR: string; |
@@ -16,3 +16,6 @@ export declare enum Currency { | ||
VIBES = "token-wvibes", | ||
BRC20_DB20 = "brc20-db20" | ||
BRC20_DB20 = "brc20-db20", | ||
aBTC = "token-abtc", | ||
sLUNR = "token-slunr", | ||
BRC20_CHAX = "brc20-chax" | ||
} |
@@ -18,3 +18,6 @@ import { AMMSwapRoute } from './ammRouteResolver'; | ||
AMM_SWAP_POOL_V1_1_ALEX_BRC20DB20 = "token-amm-swap-pool-v1-1:age000-governance-token,brc20-db20,1e8", | ||
AMM_SWAP_POOL_V1_1_SUSDT_XUSD = "token-amm-swap-pool-v1-1:token-susdt,token-wxusd,0.05e8" | ||
AMM_SWAP_POOL_V1_1_SUSDT_XUSD = "token-amm-swap-pool-v1-1:token-susdt,token-wxusd,0.05e8", | ||
AMM_SWAP_POOL_V1_1_WSTX_LUNAR = "token-amm-swap-pool-v1-1:token-wstx,token-slunr,1e8", | ||
AMM_SWAP_POOL_V1_1_SUSDT_CHAX = "token-amm-swap-pool-v1-1:token-susdt,brc20-chax,1e8", | ||
AMM_SWAP_POOL_V1_1_WSTX_ABTC = "token-amm-swap-pool-v1-1:token-wstx,token-abtc,1e8" | ||
} | ||
@@ -21,0 +24,0 @@ type SwapTokens = Currency; |
{ | ||
"version": "0.1.22", | ||
"version": "0.1.23", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -29,3 +29,3 @@ # Alex-SDK | ||
```javascript | ||
```typescript | ||
export declare class AlexSDK { | ||
@@ -37,3 +37,8 @@ getFeeRate(from: Currency, to: Currency): Promise<bigint>; | ||
getCurrencyFrom(address: string): Currency | undefined; | ||
} | ||
getLatestPrices(): Promise< | ||
Partial<{ | ||
[currency in Currency]: number; | ||
}> | ||
> | ||
} | ||
``` | ||
@@ -45,3 +50,3 @@ | ||
```javascript | ||
```typescript | ||
async function getFeeRate(from: Currency, to: Currency): Promise<bigint>; | ||
@@ -54,3 +59,3 @@ ``` | ||
```javascript | ||
```typescript | ||
async function getRouter(from: Currency, to: Currency): Promise<Currency[]>; | ||
@@ -63,3 +68,3 @@ ``` | ||
```javascript | ||
```typescript | ||
async function getAmountTo(from: Currency, fromAmount: bigint, to: Currency): Promise<bigint>; | ||
@@ -72,3 +77,3 @@ ``` | ||
```javascript | ||
```typescript | ||
function runSwap(stxAddress: string, currencyX: Currency, currencyY: Currency, fromAmount: bigint, minDy: bigint, router: Currency[]): TxToBroadCast; | ||
@@ -81,3 +86,3 @@ ``` | ||
```javascript | ||
```typescript | ||
function getCurrencyFrom(address: string): Currency | undefined; | ||
@@ -90,3 +95,3 @@ ``` | ||
```javascript | ||
```typescript | ||
function getAddressFrom(currency: Exclude<Currency, Currency.STX>): string; | ||
@@ -97,4 +102,16 @@ ``` | ||
### getLatestPrices | ||
Get a list of token prices from Alex's price endpoint | ||
```typescript | ||
getLatestPrices(): Promise< | ||
Partial<{ | ||
[currency in Currency]: number; | ||
}> | ||
> | ||
``` | ||
It will do it's best to find the price, and where it can't, it will return undefined. | ||
Check if a transaction is a swap transaction from Alex | ||
```javascript | ||
```typescript | ||
function isAlexSwapTransaction(deployer: string, contractName: string, functionName: string): boolean; | ||
@@ -106,3 +123,3 @@ ``` | ||
Broadcast a sponsored transaction to Alex's sponsored tx services | ||
```javascript | ||
```typescript | ||
function broadcastSponsoredTx(txRaw: string): Promise<string>; | ||
@@ -114,3 +131,3 @@ ```` | ||
Check if alex's swap sponsor service is activated | ||
```javascript | ||
```typescript | ||
function isSponsoredSwapEnabled(): Promise<boolean>; | ||
@@ -131,3 +148,3 @@ ```` | ||
```javascript | ||
```typescript | ||
import { AlexSDK, Currency } from 'alex-sdk'; | ||
@@ -134,0 +151,0 @@ |
@@ -81,2 +81,14 @@ import { Currency } from './currency'; | ||
}, | ||
[Currency.aBTC]: { | ||
decimals: 1e8, | ||
assetIdentifier: `SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-abtc::bridged-btc`, | ||
}, | ||
[Currency.sLUNR]: { | ||
decimals: 1e8, | ||
assetIdentifier: `SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-slunr::bridged-lunr`, | ||
}, | ||
[Currency.BRC20_CHAX]: { | ||
decimals: 1e8, | ||
assetIdentifier: `SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.brc20-chax::brc20-chax`, | ||
}, | ||
}; | ||
@@ -83,0 +95,0 @@ |
@@ -13,6 +13,9 @@ export enum Currency { | ||
CORGI = 'token-wcorgi', | ||
ATALEXV2 = "auto-alex-v2", | ||
sUSDT = "token-susdt", | ||
VIBES = "token-wvibes", | ||
BRC20_DB20 = "brc20-db20" | ||
ATALEXV2 = 'auto-alex-v2', | ||
sUSDT = 'token-susdt', | ||
VIBES = 'token-wvibes', | ||
BRC20_DB20 = 'brc20-db20', | ||
aBTC = 'token-abtc', | ||
sLUNR = 'token-slunr', | ||
BRC20_CHAX = 'brc20-chax', | ||
} |
@@ -28,2 +28,5 @@ import { AMMSwapRoute, resolveAmmRoute } from './ammRouteResolver'; | ||
AMM_SWAP_POOL_V1_1_SUSDT_XUSD = 'token-amm-swap-pool-v1-1:token-susdt,token-wxusd,0.05e8', | ||
AMM_SWAP_POOL_V1_1_WSTX_LUNAR = 'token-amm-swap-pool-v1-1:token-wstx,token-slunr,1e8', | ||
AMM_SWAP_POOL_V1_1_SUSDT_CHAX = 'token-amm-swap-pool-v1-1:token-susdt,brc20-chax,1e8', | ||
AMM_SWAP_POOL_V1_1_WSTX_ABTC = 'token-amm-swap-pool-v1-1:token-wstx,token-abtc,1e8', | ||
} | ||
@@ -68,2 +71,5 @@ | ||
Pool.AMM_SWAP_POOL_V1_1_SUSDT_XUSD, | ||
Pool.AMM_SWAP_POOL_V1_1_WSTX_LUNAR, | ||
Pool.AMM_SWAP_POOL_V1_1_SUSDT_CHAX, | ||
Pool.AMM_SWAP_POOL_V1_1_WSTX_ABTC, | ||
]; | ||
@@ -130,2 +136,8 @@ | ||
return [Currency.sUSDT, Currency.XUSD]; | ||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_LUNAR: | ||
return [Currency.STX, Currency.sLUNR]; | ||
case Pool.AMM_SWAP_POOL_V1_1_SUSDT_CHAX: | ||
return [Currency.sUSDT, Currency.BRC20_CHAX]; | ||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_ABTC: | ||
return [Currency.STX, Currency.aBTC]; | ||
default: | ||
@@ -156,2 +168,5 @@ assertNever(poolToken); | ||
case Pool.AMM_SWAP_POOL_V1_1_ALEX_BRC20DB20: | ||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_LUNAR: | ||
case Pool.AMM_SWAP_POOL_V1_1_SUSDT_CHAX: | ||
case Pool.AMM_SWAP_POOL_V1_1_WSTX_ABTC: | ||
return BigInt(1e8); | ||
@@ -158,0 +173,0 @@ case Pool.AMM_SWAP_POOL_V1_1_SUSDT_XUSD: |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1542169
21982
179