@aresrpg/aresrpg-sdk
Advanced tools
Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "@aresrpg/aresrpg-sdk", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "General SDK to interract with AresRPG", | ||
@@ -69,3 +69,3 @@ "type": "module", | ||
"devDependencies": { | ||
"@types/node": "^20.14.1", | ||
"@types/node": "^20.14.2", | ||
"@typescript-eslint/eslint-plugin": "^7.12.0", | ||
@@ -82,3 +82,3 @@ "@typescript-eslint/parser": "^7.12.0", | ||
"lint-staged": "15.2.5", | ||
"prettier": "3.3.0", | ||
"prettier": "3.3.1", | ||
"typescript": "5.4.5" | ||
@@ -85,0 +85,0 @@ }, |
@@ -44,3 +44,3 @@ import { KioskClient, Network } from '@mysten/kiosk' | ||
import { get_supported_tokens } from './sui/read/get_supported_tokens.js' | ||
import { SUPPORTED_TOKENS } from './sui/supported_tokens.js' | ||
import { SUPPORTED_TOKENS, USDC } from './sui/supported_tokens.js' | ||
import { craft_start } from './sui/write/craft_start.js' | ||
@@ -53,7 +53,10 @@ import { craft_item } from './sui/write/craft_item.js' | ||
import { split_item } from './sui/write/split_item.js' | ||
import { get_finished_crafts } from './sui/read/get_finished_crafts.js' | ||
import { get_kiosk_owner_cap } from './sui/read/get_kiosk_owner_cap.js' | ||
import { get_aresrpg_kiosk } from './sui/read/get_aresrpg_kiosk.js' | ||
const { | ||
TESTNET_PUBLISH_DIGEST = 'DzbY8HLwtHdJqUKa6FL6ooWk81jtemAA47u7YUaQfEsU', | ||
TESTNET_POLICIES_DIGEST = 'ALcjRRKL1gjYvSAh34Se3B8jqrHkSaoGisQY4qobW5g7', | ||
TESTNET_UPGRADE_DIGEST = '4N7V6D6uv4NYC8AKf8w2RqNk44AbrFue7yrtvoQmgYUw', | ||
TESTNET_PUBLISH_DIGEST = 'AAiuwyAUgLBzNxHKuMtccsL4JbmDdsmKdh49riw3FevM', | ||
TESTNET_POLICIES_DIGEST = 'AmkdzPWwcBeVsxWJwTWJmCb6BCsVkFdgrvXctJacyEbm', | ||
TESTNET_UPGRADE_DIGEST = 'FphZznx5gFHuammQMrwU8UuDmD2yyEcLNRyH3TKtzW4Q', | ||
MAINNET_PUBLISH_DIGEST = '', | ||
@@ -71,3 +74,3 @@ MAINNET_POLICIES_DIGEST = '', | ||
export { SUPPORTED_NFTS, SUPPORTED_TOKENS } | ||
export { SUPPORTED_NFTS, SUPPORTED_TOKENS, USDC } | ||
@@ -140,2 +143,5 @@ export async function SDK({ | ||
get_supported_tokens: get_supported_tokens(context), | ||
get_finished_crafts: get_finished_crafts(context), | ||
get_kiosk_owner_cap: get_kiosk_owner_cap(context), | ||
get_aresrpg_kiosk: get_aresrpg_kiosk(context), | ||
@@ -142,0 +148,0 @@ get_user_kiosks: get_user_kiosks(context), |
import { LRUCache } from 'lru-cache' | ||
import { BULLSHARK, SUPPORTED_NFTS } from './supported_nfts.js' | ||
import { BULLSHARK, CAPY, SUPPORTED_NFTS } from './supported_nfts.js' | ||
import { get_suifren_stats } from './suifrens.js' | ||
@@ -158,3 +158,3 @@ import { parse_character } from './parser.js' | ||
if (item._type === BULLSHARK) { | ||
if (item._type === BULLSHARK || item._type === CAPY) { | ||
const stats = await get_suifren_stats(context, item) | ||
@@ -161,0 +161,0 @@ return { |
@@ -42,3 +42,3 @@ import { get_items, get_purchase_caps } from './cache.js' | ||
const items = purchase_caps | ||
.map(({ item_id, kiosk_id, id, slot }) => { | ||
.map(({ item_id, kiosk_id, slot }) => { | ||
const item = corresponding_items.get(item_id) | ||
@@ -45,0 +45,0 @@ if (!item) return null |
@@ -11,5 +11,6 @@ import { parse_sui_object } from '../cache.js' | ||
id, | ||
options: { showContent: true, showType: true }, | ||
options: { showContent: true, showType: true, showDisplay: true }, | ||
}), | ||
) | ||
if (!character) return | ||
if (character._type !== `${types.PACKAGE_ID}::character::Character`) | ||
@@ -16,0 +17,0 @@ throw new Error(`INVALID_CONTRACT`) |
@@ -36,9 +36,11 @@ import { get_items } from '../cache.js' | ||
}) | ||
.map(({ objectId, listing }) => ({ | ||
id: objectId, | ||
kiosk_id, | ||
personal_kiosk_cap_id, | ||
is_kiosk_personal, | ||
...(listing && { list_price: BigInt(listing.price) }), | ||
})) | ||
.map(({ objectId, listing }) => { | ||
return { | ||
id: objectId, | ||
kiosk_id, | ||
personal_kiosk_cap_id, | ||
is_kiosk_personal, | ||
...(listing && { list_price: BigInt(listing.price) }), | ||
} | ||
}) | ||
}), | ||
@@ -45,0 +47,0 @@ ) |
import { ITEM_CATEGORY } from '../items.js' | ||
export const AFSUI = | ||
'0x02264251ff808fbf55c06f60fd1174814fd787bd32dc539531894deb497029c7::afsui::AFSUI' | ||
export const USDC = | ||
'0x02264251ff808fbf55c06f60fd1174814fd787bd32dc539531894deb497029c7::usdc::USDC' | ||
export const SUPPORTED_TOKENS = { | ||
[AFSUI]: { | ||
[USDC]: { | ||
item_category: ITEM_CATEGORY.RESOURCE, | ||
item_set: 'none', | ||
item_type: AFSUI, | ||
item_type: USDC, | ||
decimal: 9, | ||
image_url: 'https://strapi-dev.scand.app/uploads/FUD_Logo_46c0468f49.jpg', // temp | ||
is_token: true, | ||
name: 'AfSui', | ||
name: 'usdc', | ||
level: 1, | ||
}, | ||
} |
@@ -16,6 +16,6 @@ import { Transaction } from '@mysten/sui/transactions' | ||
tx.object(recipe), | ||
finished_craft, | ||
tx.object(finished_craft), | ||
tx.object('0x8'), | ||
tx.object(kiosk), | ||
kiosk_cap, | ||
tx.object(kiosk_cap), | ||
tx.object(types.ITEM_POLICY), | ||
@@ -22,0 +22,0 @@ tx.object(types.VERSION), |
@@ -5,3 +5,4 @@ import { Transaction } from '@mysten/sui/transactions' | ||
export function craft_prove_ingredients_used({ types }) { | ||
return ({ tx = new Transaction(), craft }) => | ||
return ({ tx = new Transaction(), craft }) => { | ||
console.log('craft_prove_ingredients_used', craft) | ||
tx.moveCall({ | ||
@@ -11,2 +12,3 @@ target: `${types.LATEST_PACKAGE_ID}::item_recipe::prove_all_ingredients_used`, | ||
}) | ||
} | ||
} |
@@ -5,7 +5,8 @@ import { Transaction } from '@mysten/sui/transactions' | ||
export function craft_start({ types }) { | ||
return ({ tx = new Transaction(), recipe }) => | ||
tx.moveCall({ | ||
return ({ tx = new Transaction(), recipe }) => { | ||
return tx.moveCall({ | ||
target: `${types.LATEST_PACKAGE_ID}::item_recipe::start_craft`, | ||
arguments: [tx.object(recipe)], | ||
arguments: [tx.object(recipe), tx.object(types.VERSION)], | ||
}) | ||
} | ||
} |
@@ -5,3 +5,3 @@ import { Transaction } from '@mysten/sui/transactions' | ||
export function craft_use_item_ingredient({ types }) { | ||
return ({ tx = new Transaction(), craft, kiosk, kiosk_cap, item_id }) => | ||
return ({ tx = new Transaction(), craft, kiosk, kiosk_cap, item_id }) => { | ||
tx.moveCall({ | ||
@@ -17,2 +17,3 @@ target: `${types.LATEST_PACKAGE_ID}::item_recipe::use_item_ingredient`, | ||
}) | ||
} | ||
} |
@@ -5,8 +5,9 @@ import { Transaction } from '@mysten/sui/transactions' | ||
export function craft_use_token_ingredient({ types }) { | ||
return ({ tx = new Transaction(), craft, coin, coin_type }) => | ||
return ({ tx = new Transaction(), craft, coin, coin_type }) => { | ||
tx.moveCall({ | ||
target: `${types.LATEST_PACKAGE_ID}::item_recipe::use_token_ingredient`, | ||
arguments: [craft, coin], | ||
arguments: [coin, craft], | ||
typeArguments: [coin_type], | ||
}) | ||
} | ||
} |
@@ -5,3 +5,3 @@ import { KioskTransaction } from '@mysten/kiosk' | ||
/** @param {import("../../../types.js").Context} context */ | ||
export function enforce_personal_kiosk({ kiosk_client, types }) { | ||
export function enforce_personal_kiosk({ kiosk_client }) { | ||
return async ({ tx = new Transaction(), recipient }) => { | ||
@@ -8,0 +8,0 @@ const { kioskOwnerCaps } = await kiosk_client.getOwnedKiosks({ |
@@ -13,2 +13,3 @@ import { Transaction } from '@mysten/sui/transactions' | ||
const kiosk_ref = tx.object(kiosk) | ||
tx.moveCall({ | ||
@@ -15,0 +16,0 @@ target: '0x2::kiosk::set_owner', |
@@ -27,2 +27,8 @@ export function SDK({ rpc_url, wss_url, network, websocket_constructor, }: { | ||
get_supported_tokens: (address: string) => Promise<import("../types.js").SuiToken[]>; | ||
get_finished_crafts: (owner: any) => Promise<any[]>; | ||
get_kiosk_owner_cap: ({ address, kiosk_id }: { | ||
address: any; | ||
kiosk_id: any; | ||
}) => Promise<any>; | ||
get_aresrpg_kiosk: (address: any) => Promise<import("@mysten/kiosk").KioskOwnerCap>; | ||
get_user_kiosks: ({ tx, address }: { | ||
@@ -151,3 +157,3 @@ tx?: import("@mysten/sui/transactions").Transaction; | ||
craft: any; | ||
}) => import("@mysten/sui/transactions").TransactionResult; | ||
}) => void; | ||
craft_use_item_ingredient: ({ tx, craft, kiosk, kiosk_cap, item_id }: { | ||
@@ -159,3 +165,3 @@ tx?: import("@mysten/sui/transactions").Transaction; | ||
item_id: any; | ||
}) => import("@mysten/sui/transactions").TransactionResult; | ||
}) => void; | ||
craft_use_token_ingredient: ({ tx, craft, coin, coin_type }: { | ||
@@ -166,3 +172,3 @@ tx?: import("@mysten/sui/transactions").Transaction; | ||
coin_type: any; | ||
}) => import("@mysten/sui/transactions").TransactionResult; | ||
}) => void; | ||
merge_items: ({ tx, target_kiosk, target_kiosk_cap, target_item_id, item_id, item_kiosk, item_kiosk_cap, }: { | ||
@@ -256,2 +262,3 @@ tx?: import("@mysten/sui/transactions").Transaction; | ||
import { SUPPORTED_TOKENS } from './sui/supported_tokens.js'; | ||
export { SUPPORTED_NFTS, SUPPORTED_TOKENS }; | ||
import { USDC } from './sui/supported_tokens.js'; | ||
export { SUPPORTED_NFTS, SUPPORTED_TOKENS, USDC }; |
@@ -1,4 +0,4 @@ | ||
export const AFSUI: "0x02264251ff808fbf55c06f60fd1174814fd787bd32dc539531894deb497029c7::afsui::AFSUI"; | ||
export const USDC: "0x02264251ff808fbf55c06f60fd1174814fd787bd32dc539531894deb497029c7::usdc::USDC"; | ||
export const SUPPORTED_TOKENS: { | ||
"0x02264251ff808fbf55c06f60fd1174814fd787bd32dc539531894deb497029c7::afsui::AFSUI": { | ||
"0x02264251ff808fbf55c06f60fd1174814fd787bd32dc539531894deb497029c7::usdc::USDC": { | ||
item_category: string; | ||
@@ -5,0 +5,0 @@ item_set: string; |
@@ -5,3 +5,3 @@ /** @param {import("../../../types.js").Context} context */ | ||
craft: any; | ||
}) => import("@mysten/sui/transactions").TransactionResult; | ||
}) => void; | ||
import { Transaction } from '@mysten/sui/transactions'; |
@@ -8,3 +8,3 @@ /** @param {import("../../../types.js").Context} context */ | ||
item_id: any; | ||
}) => import("@mysten/sui/transactions").TransactionResult; | ||
}) => void; | ||
import { Transaction } from '@mysten/sui/transactions'; |
@@ -7,3 +7,3 @@ /** @param {import("../../../types.js").Context} context */ | ||
coin_type: any; | ||
}) => import("@mysten/sui/transactions").TransactionResult; | ||
}) => void; | ||
import { Transaction } from '@mysten/sui/transactions'; |
/** @param {import("../../../types.js").Context} context */ | ||
export function enforce_personal_kiosk({ kiosk_client, types }: import("../../../types.js").Context): ({ tx, recipient }: { | ||
export function enforce_personal_kiosk({ kiosk_client }: import("../../../types.js").Context): ({ tx, recipient }: { | ||
tx?: Transaction; | ||
@@ -4,0 +4,0 @@ recipient: any; |
135652
133
3910