@adspacedotfun/sdk
v0.1.0
Published
AdSpace.fun SDK for embedding blockchain-powered advertisements
Maintainers
Readme
@adspacedotfun/sdk
Official SDK for embedding AdSpace.fun blockchain-powered advertisements.
Structure
src/
├── index.ts # Main entry (vanilla JS)
├── react.ts # React entry
├── vue.ts # Vue entry
│
├── core/ # Framework-agnostic core
│ ├── client.ts # AdSpaceClient - main SDK class
│ ├── config.ts # Configuration types & defaults
│ ├── contracts.ts # Contract ABIs
│ ├── types.ts # TypeScript interfaces
│ └── utils/ # IPFS & campaign helpers
│
├── react/ # React integration
│ ├── context.tsx # AdSpaceProvider
│ ├── hooks/ # useActiveAd hook
│ └── components/ # AdWidget component
│
└── vue/ # Vue integration
├── plugin.ts # Vue plugin
├── composables/ # useActiveAd composable
└── components/ # AdWidget componentHow It Works
- AdSpaceClient connects to the blockchain via JSON-RPC
- Calls
getActiveAdImage(spaceId)on the AdSpaceManager contract - Returns active campaign image (or default ad if none active)
- IPFS URLs are resolved to HTTP gateway URLs
- Framework integrations provide auto-refresh polling
Build
npm install
npm run buildOutputs ESM, CJS, and TypeScript declarations to dist/.
Publish
npm publish --access public