@phessophissy/btc-prediction-market-sdk
v1.1.2
Published
TypeScript SDK for Bitcoin Prediction Market
Downloads
2,044
Maintainers
Readme
BTC Prediction Market SDK
TypeScript SDK for interacting with the Bitcoin-anchored prediction market on Stacks.
This package is aligned with the current btc-prediction-market-v3 contract surface.
Install
npm install @phessophissy/btc-prediction-market-sdkQuick Start
import { initializeMarketSDK } from "@phessophissy/btc-prediction-market-sdk";
const sdk = initializeMarketSDK(
"YOUR_CONTRACT_ADDRESS",
true,
"btc-prediction-market-v3"
);
const marketCount = await sdk.getMarketCount();
const marketZero = await sdk.getMarket(0);Supported V3 Methods
Market
createBinaryMarket(title, description, settlementBurnHeight, senderKey)getMarket(marketId)getMarketCount()getUserPosition(marketId, userAddress)getCurrentBurnHeight()
Owner / Admin
getOwner()getPendingOwner()getContractBalance()getTotalFeesCollected()isPaused()isEmergency()transferOwnership(newOwner, senderKey)acceptOwnership(senderKey)cancelOwnershipTransfer(senderKey)enableEmergencyMode(senderKey)withdrawFees(amountMicroStx, recipient, senderKey)emergencyWithdrawAll(senderKey)emergencyWithdraw(amountMicroStx, recipient, senderKey)setPlatformPaused(paused, senderKey)
Exports
MarketContractServiceinitializeMarketSDK- V3 types from
src/types.ts - Input validators from
src/utils/validation-50.ts
Development
npm install
npm run build
npm testPublishing
The package publishes built artifacts from dist/.
npm run build
npm publish --access publicLicense
MIT
