@medialane/sdk 0.85.5 → 0.85.7
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/dist/evm/index.cjs +0 -7
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +1 -23
- package/dist/evm/index.d.ts +1 -23
- package/dist/evm/index.js +0 -7
- package/dist/evm/index.js.map +1 -1
- package/dist/index.cjs +7 -139
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -146
- package/dist/index.d.ts +4 -146
- package/dist/index.js +7 -139
- package/dist/index.js.map +1 -1
- package/dist/{services-hDpCpw3d.d.ts → services-BN4c7iT1.d.cts} +8 -329
- package/dist/{services-xJvXhXQi.d.cts → services-B_7IX3dM.d.ts} +8 -329
- package/dist/solana/index.cjs +0 -5
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +1 -14
- package/dist/solana/index.d.ts +1 -14
- package/dist/solana/index.js +0 -5
- package/dist/solana/index.js.map +1 -1
- package/dist/starknet/index.cjs +7 -219
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +2 -334
- package/dist/starknet/index.d.ts +2 -334
- package/dist/starknet/index.js +7 -219
- package/dist/starknet/index.js.map +1 -1
- package/dist/stellar/index.cjs +0 -5
- package/dist/stellar/index.cjs.map +1 -1
- package/dist/stellar/index.d.cts +1 -9
- package/dist/stellar/index.d.ts +1 -9
- package/dist/stellar/index.js +0 -5
- package/dist/stellar/index.js.map +1 -1
- package/dist/{types-sIc3OCpo.d.cts → types-nPIXtCF5.d.cts} +0 -45
- package/dist/{types-sIc3OCpo.d.ts → types-nPIXtCF5.d.ts} +0 -45
- package/package.json +1 -1
package/dist/evm/index.cjs
CHANGED
|
@@ -77,11 +77,6 @@ var COORDINATES = {
|
|
|
77
77
|
ipClubFactoryClassHash: "0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266",
|
|
78
78
|
ipClubCollectionClassHash: "0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5",
|
|
79
79
|
ipClubFactoryStartBlock: 11928775,
|
|
80
|
-
// v3 redesign (deployed 2026-07-15): single contract is both the
|
|
81
|
-
// offer/bid/proposal registry and the license collection (embeds
|
|
82
|
-
// ERC721Component directly) — no separate receipt contract, no
|
|
83
|
-
// set_minter bootstrap. Supersedes the 2026-07-02 v2 address, which had
|
|
84
|
-
// zero offers/licenses ever issued (clean cutover, no reclassification).
|
|
85
80
|
ipSponsorship: "0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c",
|
|
86
81
|
ipSponsorshipClassHash: "0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3",
|
|
87
82
|
ipSponsorshipStartBlock: 11896456,
|
|
@@ -142,8 +137,6 @@ var EvmVenue = class {
|
|
|
142
137
|
if (!contract) throw new Error(`No ${opts.variant} venue configured for ${opts.chain}`);
|
|
143
138
|
this.contract = contract;
|
|
144
139
|
}
|
|
145
|
-
/** Builds the order struct, signs the EIP-712 digest, and registers it.
|
|
146
|
-
* The digest is the canonical order id on EVM chains. */
|
|
147
140
|
async registerOrder(signer, params) {
|
|
148
141
|
const account = signer.account;
|
|
149
142
|
if (!account) throw new Error("WalletClient has no account");
|
package/dist/evm/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/evm/typedData.ts","../../src/chains.ts","../../src/evm/abis.ts","../../src/evm/venue.ts","../../src/evm/issuance.ts"],"names":["hashTypedData","parseAbi","maybeCoords","parseEventLogs"],"mappings":";;;;;AASO,IAAM,eAAA,GAAkB;AAAA,EAC7B,SAAA,EAAW;AAAA,IACT,EAAE,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,OAAA,EAAQ;AAAA,IAClC,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA,EAAU;AAAA,IACjC,EAAE,IAAA,EAA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ACD,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,CAAa,0BAA0B,EAAE,IAAA,EAAM,QAAQ,CAAA;AAClF,IAAA,MAAM,CAAC,MAAM,CAAA,GAAIA,mBAAA,CAAe;AAAA,MAC9B,GAAA,EAAK,mBAAA;AAAA,MACL,SAAA,EAAW,aAAA;AAAA,MACX,MAAM,OAAA,CAAQ;AAAA,KACf,CAAA;AACD,IAAA,OAAO,EAAE,QAAQ,OAAA,EAAA,CAAU,MAAA,EAAQ,KAAK,OAAA,IAAW,EAAA,EAAI,UAAS,EAAE;AAAA,EACpE;AAAA,EAEA,MAAM,SAAA,CACJ,MAAA,EACA,MAAA,EAC0B;AAC1B,IAAA,MAAM,UAAU,MAAA,CAAO,OAAA;AACvB,IAAA,IAAI,CAAC,OAAA,EAAS,MAAM,IAAI,MAAM,6BAA6B,CAAA;AAC3D,IAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,aAAA,CAAc;AAAA,MACxC,OAAA;AAAA,MACA,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,SAAS,MAAA,CAAO,UAAA;AAAA,MAChB,GAAA,EAAK,mBAAA;AAAA,MACL,YAAA,EAAc,WAAA;AAAA,MACd,IAAA,EAAM,CAAC,MAAA,CAAO,UAAA,EAA+B,OAAO,SAAS;AAAA,KAC9D,CAAA;AACD,IAAA,OAAO,EAAE,MAAA,EAAO;AAAA,EAClB;AACF;AAEA,SAASD,aAAY,KAAA,EAA6C;AAChE,EAAA,IAAI;AACF,IAAA,OAAO,eAAe,KAAK,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF","file":"index.cjs","sourcesContent":["import { hashTypedData, type TypedDataDomain } from \"viem\";\n\n/**\n * EIP-712 order typing for the Medialane EVM venues — byte-identical to the\n * audited Solidity (contracts/EVM-Marketplace-ERC721/src/Medialane721.sol and\n * the 1155 venue, which shares the type strings; the domain's\n * verifyingContract separates deployments and venues).\n */\n\nexport const EVM_ORDER_TYPES = {\n OfferItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n ConsiderationItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"recipient\", type: \"address\" },\n ],\n OrderParameters: [\n { name: \"offerer\", type: \"address\" },\n { name: \"offer\", type: \"OfferItem\" },\n { name: \"consideration\", type: \"ConsiderationItem\" },\n { name: \"royaltyMaxBps\", type: \"uint256\" },\n { name: \"startTime\", type: \"uint256\" },\n { name: \"endTime\", type: \"uint256\" },\n { name: \"salt\", type: \"uint256\" },\n { name: \"counter\", type: \"uint256\" },\n ],\n} as const;\n\n/** NATIVE=0, ERC20=1, ERC721=2 on the 721 venue; NATIVE=0, ERC20=1, ERC1155=2 on the 1155 venue. */\nexport type EvmItemType = 0 | 1 | 2;\n\nexport interface EvmOfferItem {\n itemType: EvmItemType;\n token: `0x${string}`;\n identifier: bigint;\n amount: bigint;\n}\n\nexport interface EvmConsiderationItem extends EvmOfferItem {\n recipient: `0x${string}`;\n}\n\nexport interface EvmOrderParameters {\n offerer: `0x${string}`;\n offer: EvmOfferItem;\n consideration: EvmConsiderationItem;\n royaltyMaxBps: bigint;\n startTime: bigint;\n endTime: bigint;\n salt: bigint;\n counter: bigint;\n}\n\nexport function evmOrderDomain(chainId: number, verifyingContract: `0x${string}`): TypedDataDomain {\n return { name: \"Medialane\", version: \"1\", chainId, verifyingContract };\n}\n\n/** The order's EIP-712 digest — the venue's order hash and the platform's\n * canonical order id on EVM chains. */\nexport function evmOrderDigest(\n chainId: number,\n verifyingContract: `0x${string}`,\n parameters: EvmOrderParameters,\n): `0x${string}` {\n return hashTypedData({\n domain: evmOrderDomain(chainId, verifyingContract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: parameters,\n });\n}\n","// Single source of per-chain coordinates for Medialane's own services\n// (spec 2026-06-13 §3.1, Decision A). Keyed by CHAIN ALONE — Medialane is\n// mainnet-only, so there is no network axis (refines decisions.md D-9).\n\n/** Mirrors the backend Prisma `Chain` enum. */\nexport const CHAINS = [\"STARKNET\", \"ETHEREUM\", \"SOLANA\", \"BASE\", \"STELLAR\", \"BITCOIN\"] as const;\nexport type Chain = (typeof CHAINS)[number];\n\n/** Starknet coordinates of Medialane services + venues. All fields optional\n * because not every service exists on every chain. */\nexport interface StarknetCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721ClassHash?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155ClassHash?: `0x${string}`;\n marketplace1155StartBlock?: number;\n collection721?: `0x${string}`;\n collection721StartBlock?: number;\n ipNftClassHash?: `0x${string}`;\n ipCollectionClassHash?: `0x${string}`;\n collection1155?: `0x${string}`;\n collection1155FactoryClassHash?: `0x${string}`;\n collection1155ClassHash?: `0x${string}`;\n collection1155StartBlock?: number;\n popFactory?: `0x${string}`;\n popCollectionClassHash?: `0x${string}`;\n dropFactory?: `0x${string}`;\n dropCollectionClassHash?: `0x${string}`;\n nftComments?: `0x${string}`;\n creatorCoinFactory?: `0x${string}`;\n creatorCoinEkuboLauncher?: `0x${string}`;\n creatorCoinClassHash?: `0x${string}`;\n creatorCoinFactoryClassHash?: `0x${string}`;\n creatorCoinStartBlock?: number;\n ekuboCore?: `0x${string}`;\n ipTicketsFactory?: `0x${string}`;\n ipTicketCollectionClassHash?: `0x${string}`;\n ipTicketsFactoryClassHash?: `0x${string}`;\n ipTicketsStartBlock?: number;\n ipClubFactory?: `0x${string}`;\n ipClubFactoryClassHash?: `0x${string}`;\n ipClubCollectionClassHash?: `0x${string}`;\n ipClubFactoryStartBlock?: number;\n ipSponsorship?: `0x${string}`;\n ipSponsorshipClassHash?: `0x${string}`;\n ipSponsorshipStartBlock?: number;\n mediaWalletClassHash?: `0x${string}`;\n}\n\n/** Coordinates per chain. Only STARKNET is populated today; adding a chain\n * means adding an entry here (litmus test, spec §7). */\n/** EVM coordinates — one shape for Ethereum and Base (same bytecode, two\n * chains). Populated at deploy time (federation Phase 4). */\nexport interface EvmCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155StartBlock?: number;\n mipRegistry?: `0x${string}`;\n mipRegistryStartBlock?: number;\n mipEditionsRegistry?: `0x${string}`;\n mipEditionsRegistryStartBlock?: number;\n}\n\n/** Solana coordinates — base58 program ids. Populated at deploy time. */\nexport interface SolanaCoordinates {\n rpcUrl: string;\n mipCollectionsProgram?: string;\n marketplaceProgram?: string;\n startSlot?: number;\n}\n\n/** Stellar (Soroban) coordinates — strkey contract ids. Populated at deploy\n * time; the registry takes the collection WASM hash as a constructor arg. */\nexport interface StellarCoordinates {\n rpcUrl: string;\n mipRegistry?: string;\n marketplace?: string;\n collectionWasmHash?: string;\n startLedger?: number;\n}\n\n/** Per-chain coordinate shapes. Every chain is an equal entry — no chain is\n * privileged in core (chain-sovereignty I2/I4). */\nexport interface CoordinatesByChain {\n STARKNET?: StarknetCoordinates;\n ETHEREUM?: EvmCoordinates;\n BASE?: EvmCoordinates;\n SOLANA?: SolanaCoordinates;\n STELLAR?: StellarCoordinates;\n BITCOIN?: never;\n}\n\n/** @deprecated Renamed — use `StarknetCoordinates` (coordinates are per-chain-shaped). */\nexport type ChainCoordinates = StarknetCoordinates;\n\nconst COORDINATES: CoordinatesByChain = {\n STARKNET: {\n rpcUrl: \"https://rpc.starknet.lava.build\",\n marketplace721: \"0x03eda9a2b6ad90845a43591bac8083ebaf677d51fdf20f503b2c01889e3131fc\",\n marketplace721ClassHash: \"0x0700d9230d07e5203e27778c0dc70f9134d2b25bf319f7cf8348dc66a6923e90\",\n marketplace721StartBlock: 11198146,\n marketplace1155: \"0x07c4ce1c19ea48cc11135ed22b19ff745f5aec508c3828593002e4f76fdb1b38\",\n marketplace1155ClassHash: \"0x0242f5c388da7cee2d99e2a69453c8159bf927fbec4e797a3cfdcbbcb5b68328\",\n marketplace1155StartBlock: 11198267,\n collection721: \"0x0225c3ae09506b8d97adc39649ca740dad5aac195b7f5f0441cc1852947acaea\",\n collection721StartBlock: 11198496,\n ipNftClassHash: \"0x012d3ae40ba35c7e2be0946532dac60e48932447912fdf96b674da67c029b9cc\",\n ipCollectionClassHash: \"0x022155a1a130a40e57aac4b89c07fab3f616bc351b1270fc40f756b963afe8b4\",\n collection1155: \"0x015368976d46fae5bfa1c58600f641d5aa5dbbf53ebc6b78aa3922194aad3551\",\n collection1155FactoryClassHash: \"0x04eb6b419770f13bd191f120b9fc9ee624c0613ad4490062d293ca2016b3b1d2\",\n collection1155ClassHash: \"0x06cf3f5a2322dac35e07a6064a5b8802f19fda8aa3f4726f0cb7bc05dea1bd78\",\n collection1155StartBlock: 11199527,\n popFactory: \"0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111\",\n popCollectionClassHash: \"0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f\",\n dropFactory: \"0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800\",\n dropCollectionClassHash: \"0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282\",\n nftComments: \"0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843\",\n creatorCoinFactory: \"0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c\",\n creatorCoinEkuboLauncher: \"0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4\",\n creatorCoinClassHash: \"0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6\",\n creatorCoinFactoryClassHash: \"0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55\",\n creatorCoinStartBlock: 10474544,\n ekuboCore: \"0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b\",\n ipTicketsFactory: \"0x0767bf5b57e1f812463159b5ed683183e1b0c3f942b74871b5c6cd6a93c15e99\",\n ipTicketCollectionClassHash: \"0x0449e8eb7c117740d07cb8e0157d32c8ba3d19d1cfd2784ed5e139f5a1e04acc\",\n ipTicketsFactoryClassHash: \"0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a\",\n ipTicketsStartBlock: 11933694,\n ipClubFactory: \"0x06a0b0be16d70c78f2e18119dbf90e5911cbfd5d8d484bc555dc61d96f56a2b9\",\n ipClubFactoryClassHash: \"0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266\",\n ipClubCollectionClassHash: \"0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5\",\n ipClubFactoryStartBlock: 11928775,\n // v3 redesign (deployed 2026-07-15): single contract is both the\n // offer/bid/proposal registry and the license collection (embeds\n // ERC721Component directly) — no separate receipt contract, no\n // set_minter bootstrap. Supersedes the 2026-07-02 v2 address, which had\n // zero offers/licenses ever issued (clean cutover, no reclassification).\n ipSponsorship: \"0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c\",\n ipSponsorshipClassHash: \"0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3\",\n ipSponsorshipStartBlock: 11896456,\n mediaWalletClassHash: \"0x014b210c7d47392691144bafecdca3c6c7791cc295ea305988da0a724c05ac31\",\n },\n};\n\nexport function getCoordinates(chain: \"STARKNET\"): StarknetCoordinates;\nexport function getCoordinates(chain: \"ETHEREUM\" | \"BASE\"): EvmCoordinates;\nexport function getCoordinates(chain: \"SOLANA\"): SolanaCoordinates;\nexport function getCoordinates(chain: \"STELLAR\"): StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates {\n const c = COORDINATES[chain];\n if (!c) throw new Error(`No coordinates configured for chain \"${chain}\"`);\n return c;\n}\n\nexport const DEFAULT_CHAIN: Chain = \"STARKNET\";\n\n/** Typed Starknet coordinates for Starknet-only modules; throws when the\n * client is scoped to another chain. */\nexport function getStarknetCoordinates(chain: Chain): StarknetCoordinates {\n if (chain !== \"STARKNET\") {\n throw new Error(`This module is Starknet-only (client chain: \"${chain}\")`);\n }\n return getCoordinates(\"STARKNET\");\n}\n","import { parseAbi } from \"viem\";\n\n/** Minimal venue ABI — verified against Medialane721.sol / Medialane1155.sol.\n * The 1155 venue's fulfillOrder additionally takes a quantity. */\nexport const EvmVenueABI = parseAbi([\n \"struct OfferItem { uint8 itemType; address token; uint256 identifier; uint256 amount; }\",\n \"struct ConsiderationItem { uint8 itemType; address token; uint256 identifier; uint256 amount; address recipient; }\",\n \"struct OrderParameters { address offerer; OfferItem offer; ConsiderationItem consideration; uint256 royaltyMaxBps; uint256 startTime; uint256 endTime; uint256 salt; uint256 counter; }\",\n \"function registerOrder(OrderParameters parameters, bytes signature)\",\n \"function fulfillOrder(bytes32 orderHash) payable\",\n \"function cancelOrder(bytes32 orderHash)\",\n \"function incrementCounter()\",\n \"function getOrderHash(OrderParameters parameters) view returns (bytes32)\",\n \"function getCounter(address offerer) view returns (uint256)\",\n \"function version() pure returns (string)\",\n \"event OrderCreated(bytes32 indexed orderHash, address indexed offerer)\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n \"event OrderCancelled(bytes32 indexed orderHash, address indexed offerer)\",\n \"event CounterIncremented(address indexed offerer, uint256 newCounter)\",\n]);\n\nexport const EvmVenue1155ABI = parseAbi([\n \"function fulfillOrder(bytes32 orderHash, uint256 quantity) payable\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 quantity, uint256 remainingAmount, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n]);\n\n/** MIP issuance — verified against MIPRegistry.sol / MIPCollection.sol (and\n * the editions pair, which shares the registry surface). */\nexport const EvmMipRegistryABI = parseAbi([\n \"function createCollection(string name, string symbol, string baseUri, uint96 royaltyBps) returns (uint256 collectionId, address collection)\",\n \"function getCollection(uint256 collectionId) view returns (address collection, address creator)\",\n \"function collectionCount() view returns (uint256)\",\n \"event CollectionCreated(uint256 indexed collectionId, address indexed collection, address indexed creator, string name, string symbol, string baseUri)\",\n]);\n\nexport const EvmMipCollectionABI = parseAbi([\n \"function mint(address to, string metadataUri) returns (uint256 tokenId)\",\n \"function batchMint(address[] to, string[] metadataUris) returns (uint256[] tokenIds)\",\n \"function tokenURI(uint256 tokenId) view returns (string)\",\n \"function ownerOf(uint256 tokenId) view returns (address)\",\n \"function balanceOf(address owner) view returns (uint256)\",\n \"function owner() view returns (address)\",\n \"event TokenMinted(uint256 indexed tokenId, address indexed owner, string metadataUri)\",\n \"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)\",\n]);\n","import type { PublicClient, WalletClient } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type {\n AdapterTxResult,\n OrderRef,\n RegisterOrderParams,\n VenueAdapter,\n} from \"../adapters/types.js\";\nimport { EvmVenueABI, EvmVenue1155ABI } from \"./abis.js\";\nimport {\n EVM_ORDER_TYPES,\n evmOrderDigest,\n evmOrderDomain,\n type EvmOrderParameters,\n} from \"./typedData.js\";\n\nexport type EvmChain = \"ETHEREUM\" | \"BASE\";\n\nexport interface EvmVenueOptions {\n chain: EvmChain;\n chainId: number;\n publicClient: PublicClient;\n /** \"721\" (unique assets) or \"1155\" (partial fills). */\n variant: \"721\" | \"1155\";\n /** Defaults to the chain registry's venue address (populated at deploy). */\n contract?: `0x${string}`;\n}\n\n/** The Medialane venue adapter for EVM chains — one implementation serves\n * Ethereum and Base (same bytecode; the EIP-712 domain separates them). */\nexport class EvmVenue implements VenueAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly chainId: number;\n private readonly contract: `0x${string}`;\n private readonly publicClient: PublicClient;\n private readonly variant: \"721\" | \"1155\";\n\n constructor(opts: EvmVenueOptions) {\n this.chain = opts.chain;\n this.chainId = opts.chainId;\n this.publicClient = opts.publicClient;\n this.variant = opts.variant;\n const coords = maybeCoords(opts.chain);\n const contract =\n opts.contract ?? (opts.variant === \"721\" ? coords?.marketplace721 : coords?.marketplace1155);\n if (!contract) throw new Error(`No ${opts.variant} venue configured for ${opts.chain}`);\n this.contract = contract;\n }\n\n /** Builds the order struct, signs the EIP-712 digest, and registers it.\n * The digest is the canonical order id on EVM chains. */\n async registerOrder(\n signer: WalletClient,\n params: RegisterOrderParams,\n ): Promise<AdapterTxResult & { orderRef: OrderRef }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const counter = await this.getCounter(account.address);\n const nft = {\n itemType: 2 as const,\n token: params.asset.contract as `0x${string}`,\n identifier: BigInt(params.asset.tokenId),\n amount: 1n,\n };\n const payment = {\n itemType: (params.paymentToken === NATIVE_SENTINEL ? 0 : 1) as 0 | 1,\n token: (params.paymentToken === NATIVE_SENTINEL\n ? \"0x0000000000000000000000000000000000000000\"\n : params.paymentToken) as `0x${string}`,\n identifier: 0n,\n amount: BigInt(params.amount),\n };\n const order: EvmOrderParameters =\n params.side === \"listing\"\n ? {\n offerer: account.address,\n offer: nft,\n consideration: { ...payment, recipient: account.address },\n ...commonFields(params),\n }\n : {\n offerer: account.address,\n offer: payment,\n consideration: { ...nft, recipient: account.address },\n ...commonFields(params),\n };\n order.counter = counter;\n\n const signature = await signer.signTypedData({\n account,\n domain: evmOrderDomain(this.chainId, this.contract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: order,\n });\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"registerOrder\",\n args: [order, signature],\n });\n return { txHash, orderRef: evmOrderDigest(this.chainId, this.contract, order) };\n }\n\n async fulfillOrder(\n signer: WalletClient,\n orderRef: OrderRef,\n opts?: { quantity?: string; value?: string },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const value = opts?.value ? BigInt(opts.value) : undefined;\n const txHash =\n this.variant === \"1155\"\n ? await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenue1155ABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`, BigInt(opts?.quantity ?? \"1\")],\n value,\n })\n : await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`],\n value,\n });\n return { txHash };\n }\n\n async cancelOrder(signer: WalletClient, orderRef: OrderRef): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"cancelOrder\",\n args: [orderRef as `0x${string}`],\n });\n return { txHash };\n }\n\n async incrementCounter(signer: WalletClient): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"incrementCounter\",\n args: [],\n });\n return { txHash };\n }\n\n async getOrderDetails(orderRef: OrderRef): Promise<unknown> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: [\n {\n type: \"function\",\n name: \"getOrderDetails\",\n stateMutability: \"view\",\n inputs: [{ name: \"orderHash\", type: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"bytes\" }],\n },\n ] as const,\n functionName: \"getOrderDetails\",\n args: [orderRef as `0x${string}`],\n });\n }\n\n async getCounter(address: string): Promise<bigint> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"getCounter\",\n args: [address as `0x${string}`],\n });\n }\n}\n\n/** Payment-token sentinel for native ETH (spec §3.2b currency encoding). */\nexport const NATIVE_SENTINEL = \"native\";\n\nfunction commonFields(params: RegisterOrderParams) {\n return {\n royaltyMaxBps: BigInt(params.royaltyMaxBps),\n startTime: BigInt(params.startTime),\n endTime: BigInt(params.endTime),\n salt: BigInt(params.salt),\n counter: 0n,\n };\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n","import type { PublicClient, WalletClient } from \"viem\";\nimport { parseEventLogs } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type { AdapterTxResult, CreateCollectionInput, IssuanceAdapter, MintInput } from \"../adapters/types.js\";\nimport { EvmMipCollectionABI, EvmMipRegistryABI } from \"./abis.js\";\nimport type { EvmChain } from \"./venue.js\";\n\nexport interface EvmIssuanceOptions {\n chain: EvmChain;\n publicClient: PublicClient;\n /** Defaults to the chain registry's MIP registry (populated at deploy). */\n registry?: `0x${string}`;\n}\n\n/** The Mediolano issuance adapter for EVM chains. */\nexport class EvmIssuance implements IssuanceAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly registry: `0x${string}`;\n private readonly publicClient: PublicClient;\n\n constructor(opts: EvmIssuanceOptions) {\n this.chain = opts.chain;\n this.publicClient = opts.publicClient;\n const registry = opts.registry ?? maybeCoords(opts.chain)?.mipRegistry;\n if (!registry) throw new Error(`No MIP registry configured for ${opts.chain}`);\n this.registry = registry;\n }\n\n async createCollection(\n signer: WalletClient,\n params: CreateCollectionInput,\n ): Promise<AdapterTxResult & { collection: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.registry,\n abi: EvmMipRegistryABI,\n functionName: \"createCollection\",\n args: [params.name, params.symbol, params.baseUri, BigInt(params.royaltyBps)],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [created] = parseEventLogs({\n abi: EvmMipRegistryABI,\n eventName: \"CollectionCreated\",\n logs: receipt.logs,\n });\n return { txHash, collection: created?.args.collection ?? \"\" };\n }\n\n async mint(signer: WalletClient, params: MintInput): Promise<AdapterTxResult & { tokenId: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"mint\",\n args: [params.recipient as `0x${string}`, params.tokenUri],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [minted] = parseEventLogs({\n abi: EvmMipCollectionABI,\n eventName: \"TokenMinted\",\n logs: receipt.logs,\n });\n return { txHash, tokenId: (minted?.args.tokenId ?? 0n).toString() };\n }\n\n async batchMint(\n signer: WalletClient,\n params: { collection: string; recipients: string[]; tokenUris: string[] },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"batchMint\",\n args: [params.recipients as `0x${string}`[], params.tokenUris],\n });\n return { txHash };\n }\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/evm/typedData.ts","../../src/chains.ts","../../src/evm/abis.ts","../../src/evm/venue.ts","../../src/evm/issuance.ts"],"names":["hashTypedData","parseAbi","maybeCoords","parseEventLogs"],"mappings":";;;;;AAEO,IAAM,eAAA,GAAkB;AAAA,EAC7B,S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const EVM_ORDER_TYPES = {\n OfferItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n ConsiderationItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"recipient\", type: \"address\" },\n ],\n OrderParameters: [\n { name: \"offerer\", type: \"address\" },\n { name: \"offer\", type: \"OfferItem\" },\n { name: \"consideration\", type: \"ConsiderationItem\" },\n { name: \"royaltyMaxBps\", type: \"uint256\" },\n { name: \"startTime\", type: \"uint256\" },\n { name: \"endTime\", type: \"uint256\" },\n { name: \"salt\", type: \"uint256\" },\n { name: \"counter\", type: \"uint256\" },\n ],\n} as const;\n\nexport type EvmItemType = 0 | 1 | 2;\n\nexport interface EvmOfferItem {\n itemType: EvmItemType;\n token: `0x${string}`;\n identifier: bigint;\n amount: bigint;\n}\n\nexport interface EvmConsiderationItem extends EvmOfferItem {\n recipient: `0x${string}`;\n}\n\nexport interface EvmOrderParameters {\n offerer: `0x${string}`;\n offer: EvmOfferItem;\n consideration: EvmConsiderationItem;\n royaltyMaxBps: bigint;\n startTime: bigint;\n endTime: bigint;\n salt: bigint;\n counter: bigint;\n}\n\nexport function evmOrderDomain(chainId: number, verifyingContract: `0x${string}`): TypedDataDomain {\n return { name: \"Medialane\", version: \"1\", chainId, verifyingContract };\n}\n\nexport function evmOrderDigest(\n chainId: number,\n verifyingContract: `0x${string}`,\n parameters: EvmOrderParameters,\n): `0x${string}` {\n return hashTypedData({\n domain: evmOrderDomain(chainId, verifyingContract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: parameters,\n });\n}\n","\n\nexport const CHAINS = [\"STARKNET\", \"ETHEREUM\", \"SOLANA\", \"BASE\", \"STELLAR\", \"BITCOIN\"] as const;\nexport type Chain = (typeof CHAINS)[number];\n\nexport interface StarknetCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721ClassHash?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155ClassHash?: `0x${string}`;\n marketplace1155StartBlock?: number;\n collection721?: `0x${string}`;\n collection721StartBlock?: number;\n ipNftClassHash?: `0x${string}`;\n ipCollectionClassHash?: `0x${string}`;\n collection1155?: `0x${string}`;\n collection1155FactoryClassHash?: `0x${string}`;\n collection1155ClassHash?: `0x${string}`;\n collection1155StartBlock?: number;\n popFactory?: `0x${string}`;\n popCollectionClassHash?: `0x${string}`;\n dropFactory?: `0x${string}`;\n dropCollectionClassHash?: `0x${string}`;\n nftComments?: `0x${string}`;\n creatorCoinFactory?: `0x${string}`;\n creatorCoinEkuboLauncher?: `0x${string}`;\n creatorCoinClassHash?: `0x${string}`;\n creatorCoinFactoryClassHash?: `0x${string}`;\n creatorCoinStartBlock?: number;\n ekuboCore?: `0x${string}`;\n ipTicketsFactory?: `0x${string}`;\n ipTicketCollectionClassHash?: `0x${string}`;\n ipTicketsFactoryClassHash?: `0x${string}`;\n ipTicketsStartBlock?: number;\n ipClubFactory?: `0x${string}`;\n ipClubFactoryClassHash?: `0x${string}`;\n ipClubCollectionClassHash?: `0x${string}`;\n ipClubFactoryStartBlock?: number;\n ipSponsorship?: `0x${string}`;\n ipSponsorshipClassHash?: `0x${string}`;\n ipSponsorshipStartBlock?: number;\n mediaWalletClassHash?: `0x${string}`;\n}\n\nexport interface EvmCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155StartBlock?: number;\n mipRegistry?: `0x${string}`;\n mipRegistryStartBlock?: number;\n mipEditionsRegistry?: `0x${string}`;\n mipEditionsRegistryStartBlock?: number;\n}\n\nexport interface SolanaCoordinates {\n rpcUrl: string;\n mipCollectionsProgram?: string;\n marketplaceProgram?: string;\n startSlot?: number;\n}\n\nexport interface StellarCoordinates {\n rpcUrl: string;\n mipRegistry?: string;\n marketplace?: string;\n collectionWasmHash?: string;\n startLedger?: number;\n}\n\nexport interface CoordinatesByChain {\n STARKNET?: StarknetCoordinates;\n ETHEREUM?: EvmCoordinates;\n BASE?: EvmCoordinates;\n SOLANA?: SolanaCoordinates;\n STELLAR?: StellarCoordinates;\n BITCOIN?: never;\n}\n\nexport type ChainCoordinates = StarknetCoordinates;\n\nconst COORDINATES: CoordinatesByChain = {\n STARKNET: {\n rpcUrl: \"https://rpc.starknet.lava.build\",\n marketplace721: \"0x03eda9a2b6ad90845a43591bac8083ebaf677d51fdf20f503b2c01889e3131fc\",\n marketplace721ClassHash: \"0x0700d9230d07e5203e27778c0dc70f9134d2b25bf319f7cf8348dc66a6923e90\",\n marketplace721StartBlock: 11198146,\n marketplace1155: \"0x07c4ce1c19ea48cc11135ed22b19ff745f5aec508c3828593002e4f76fdb1b38\",\n marketplace1155ClassHash: \"0x0242f5c388da7cee2d99e2a69453c8159bf927fbec4e797a3cfdcbbcb5b68328\",\n marketplace1155StartBlock: 11198267,\n collection721: \"0x0225c3ae09506b8d97adc39649ca740dad5aac195b7f5f0441cc1852947acaea\",\n collection721StartBlock: 11198496,\n ipNftClassHash: \"0x012d3ae40ba35c7e2be0946532dac60e48932447912fdf96b674da67c029b9cc\",\n ipCollectionClassHash: \"0x022155a1a130a40e57aac4b89c07fab3f616bc351b1270fc40f756b963afe8b4\",\n collection1155: \"0x015368976d46fae5bfa1c58600f641d5aa5dbbf53ebc6b78aa3922194aad3551\",\n collection1155FactoryClassHash: \"0x04eb6b419770f13bd191f120b9fc9ee624c0613ad4490062d293ca2016b3b1d2\",\n collection1155ClassHash: \"0x06cf3f5a2322dac35e07a6064a5b8802f19fda8aa3f4726f0cb7bc05dea1bd78\",\n collection1155StartBlock: 11199527,\n popFactory: \"0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111\",\n popCollectionClassHash: \"0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f\",\n dropFactory: \"0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800\",\n dropCollectionClassHash: \"0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282\",\n nftComments: \"0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843\",\n creatorCoinFactory: \"0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c\",\n creatorCoinEkuboLauncher: \"0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4\",\n creatorCoinClassHash: \"0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6\",\n creatorCoinFactoryClassHash: \"0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55\",\n creatorCoinStartBlock: 10474544,\n ekuboCore: \"0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b\",\n ipTicketsFactory: \"0x0767bf5b57e1f812463159b5ed683183e1b0c3f942b74871b5c6cd6a93c15e99\",\n ipTicketCollectionClassHash: \"0x0449e8eb7c117740d07cb8e0157d32c8ba3d19d1cfd2784ed5e139f5a1e04acc\",\n ipTicketsFactoryClassHash: \"0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a\",\n ipTicketsStartBlock: 11933694,\n ipClubFactory: \"0x06a0b0be16d70c78f2e18119dbf90e5911cbfd5d8d484bc555dc61d96f56a2b9\",\n ipClubFactoryClassHash: \"0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266\",\n ipClubCollectionClassHash: \"0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5\",\n ipClubFactoryStartBlock: 11928775,\n\n ipSponsorship: \"0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c\",\n ipSponsorshipClassHash: \"0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3\",\n ipSponsorshipStartBlock: 11896456,\n mediaWalletClassHash: \"0x014b210c7d47392691144bafecdca3c6c7791cc295ea305988da0a724c05ac31\",\n },\n};\n\nexport function getCoordinates(chain: \"STARKNET\"): StarknetCoordinates;\nexport function getCoordinates(chain: \"ETHEREUM\" | \"BASE\"): EvmCoordinates;\nexport function getCoordinates(chain: \"SOLANA\"): SolanaCoordinates;\nexport function getCoordinates(chain: \"STELLAR\"): StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates {\n const c = COORDINATES[chain];\n if (!c) throw new Error(`No coordinates configured for chain \"${chain}\"`);\n return c;\n}\n\nexport const DEFAULT_CHAIN: Chain = \"STARKNET\";\n\nexport function getStarknetCoordinates(chain: Chain): StarknetCoordinates {\n if (chain !== \"STARKNET\") {\n throw new Error(`This module is Starknet-only (client chain: \"${chain}\")`);\n }\n return getCoordinates(\"STARKNET\");\n}\n","import { parseAbi } from \"viem\";\n\nexport const EvmVenueABI = parseAbi([\n \"struct OfferItem { uint8 itemType; address token; uint256 identifier; uint256 amount; }\",\n \"struct ConsiderationItem { uint8 itemType; address token; uint256 identifier; uint256 amount; address recipient; }\",\n \"struct OrderParameters { address offerer; OfferItem offer; ConsiderationItem consideration; uint256 royaltyMaxBps; uint256 startTime; uint256 endTime; uint256 salt; uint256 counter; }\",\n \"function registerOrder(OrderParameters parameters, bytes signature)\",\n \"function fulfillOrder(bytes32 orderHash) payable\",\n \"function cancelOrder(bytes32 orderHash)\",\n \"function incrementCounter()\",\n \"function getOrderHash(OrderParameters parameters) view returns (bytes32)\",\n \"function getCounter(address offerer) view returns (uint256)\",\n \"function version() pure returns (string)\",\n \"event OrderCreated(bytes32 indexed orderHash, address indexed offerer)\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n \"event OrderCancelled(bytes32 indexed orderHash, address indexed offerer)\",\n \"event CounterIncremented(address indexed offerer, uint256 newCounter)\",\n]);\n\nexport const EvmVenue1155ABI = parseAbi([\n \"function fulfillOrder(bytes32 orderHash, uint256 quantity) payable\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 quantity, uint256 remainingAmount, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n]);\n\nexport const EvmMipRegistryABI = parseAbi([\n \"function createCollection(string name, string symbol, string baseUri, uint96 royaltyBps) returns (uint256 collectionId, address collection)\",\n \"function getCollection(uint256 collectionId) view returns (address collection, address creator)\",\n \"function collectionCount() view returns (uint256)\",\n \"event CollectionCreated(uint256 indexed collectionId, address indexed collection, address indexed creator, string name, string symbol, string baseUri)\",\n]);\n\nexport const EvmMipCollectionABI = parseAbi([\n \"function mint(address to, string metadataUri) returns (uint256 tokenId)\",\n \"function batchMint(address[] to, string[] metadataUris) returns (uint256[] tokenIds)\",\n \"function tokenURI(uint256 tokenId) view returns (string)\",\n \"function ownerOf(uint256 tokenId) view returns (address)\",\n \"function balanceOf(address owner) view returns (uint256)\",\n \"function owner() view returns (address)\",\n \"event TokenMinted(uint256 indexed tokenId, address indexed owner, string metadataUri)\",\n \"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)\",\n]);\n","import type { PublicClient, WalletClient } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type {\n AdapterTxResult,\n OrderRef,\n RegisterOrderParams,\n VenueAdapter,\n} from \"../adapters/types.js\";\nimport { EvmVenueABI, EvmVenue1155ABI } from \"./abis.js\";\nimport {\n EVM_ORDER_TYPES,\n evmOrderDigest,\n evmOrderDomain,\n type EvmOrderParameters,\n} from \"./typedData.js\";\n\nexport type EvmChain = \"ETHEREUM\" | \"BASE\";\n\nexport interface EvmVenueOptions {\n chain: EvmChain;\n chainId: number;\n publicClient: PublicClient;\n\n variant: \"721\" | \"1155\";\n\n contract?: `0x${string}`;\n}\n\nexport class EvmVenue implements VenueAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly chainId: number;\n private readonly contract: `0x${string}`;\n private readonly publicClient: PublicClient;\n private readonly variant: \"721\" | \"1155\";\n\n constructor(opts: EvmVenueOptions) {\n this.chain = opts.chain;\n this.chainId = opts.chainId;\n this.publicClient = opts.publicClient;\n this.variant = opts.variant;\n const coords = maybeCoords(opts.chain);\n const contract =\n opts.contract ?? (opts.variant === \"721\" ? coords?.marketplace721 : coords?.marketplace1155);\n if (!contract) throw new Error(`No ${opts.variant} venue configured for ${opts.chain}`);\n this.contract = contract;\n }\n\n async registerOrder(\n signer: WalletClient,\n params: RegisterOrderParams,\n ): Promise<AdapterTxResult & { orderRef: OrderRef }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const counter = await this.getCounter(account.address);\n const nft = {\n itemType: 2 as const,\n token: params.asset.contract as `0x${string}`,\n identifier: BigInt(params.asset.tokenId),\n amount: 1n,\n };\n const payment = {\n itemType: (params.paymentToken === NATIVE_SENTINEL ? 0 : 1) as 0 | 1,\n token: (params.paymentToken === NATIVE_SENTINEL\n ? \"0x0000000000000000000000000000000000000000\"\n : params.paymentToken) as `0x${string}`,\n identifier: 0n,\n amount: BigInt(params.amount),\n };\n const order: EvmOrderParameters =\n params.side === \"listing\"\n ? {\n offerer: account.address,\n offer: nft,\n consideration: { ...payment, recipient: account.address },\n ...commonFields(params),\n }\n : {\n offerer: account.address,\n offer: payment,\n consideration: { ...nft, recipient: account.address },\n ...commonFields(params),\n };\n order.counter = counter;\n\n const signature = await signer.signTypedData({\n account,\n domain: evmOrderDomain(this.chainId, this.contract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: order,\n });\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"registerOrder\",\n args: [order, signature],\n });\n return { txHash, orderRef: evmOrderDigest(this.chainId, this.contract, order) };\n }\n\n async fulfillOrder(\n signer: WalletClient,\n orderRef: OrderRef,\n opts?: { quantity?: string; value?: string },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const value = opts?.value ? BigInt(opts.value) : undefined;\n const txHash =\n this.variant === \"1155\"\n ? await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenue1155ABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`, BigInt(opts?.quantity ?? \"1\")],\n value,\n })\n : await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`],\n value,\n });\n return { txHash };\n }\n\n async cancelOrder(signer: WalletClient, orderRef: OrderRef): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"cancelOrder\",\n args: [orderRef as `0x${string}`],\n });\n return { txHash };\n }\n\n async incrementCounter(signer: WalletClient): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"incrementCounter\",\n args: [],\n });\n return { txHash };\n }\n\n async getOrderDetails(orderRef: OrderRef): Promise<unknown> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: [\n {\n type: \"function\",\n name: \"getOrderDetails\",\n stateMutability: \"view\",\n inputs: [{ name: \"orderHash\", type: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"bytes\" }],\n },\n ] as const,\n functionName: \"getOrderDetails\",\n args: [orderRef as `0x${string}`],\n });\n }\n\n async getCounter(address: string): Promise<bigint> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"getCounter\",\n args: [address as `0x${string}`],\n });\n }\n}\n\nexport const NATIVE_SENTINEL = \"native\";\n\nfunction commonFields(params: RegisterOrderParams) {\n return {\n royaltyMaxBps: BigInt(params.royaltyMaxBps),\n startTime: BigInt(params.startTime),\n endTime: BigInt(params.endTime),\n salt: BigInt(params.salt),\n counter: 0n,\n };\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n","import type { PublicClient, WalletClient } from \"viem\";\nimport { parseEventLogs } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type { AdapterTxResult, CreateCollectionInput, IssuanceAdapter, MintInput } from \"../adapters/types.js\";\nimport { EvmMipCollectionABI, EvmMipRegistryABI } from \"./abis.js\";\nimport type { EvmChain } from \"./venue.js\";\n\nexport interface EvmIssuanceOptions {\n chain: EvmChain;\n publicClient: PublicClient;\n\n registry?: `0x${string}`;\n}\n\nexport class EvmIssuance implements IssuanceAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly registry: `0x${string}`;\n private readonly publicClient: PublicClient;\n\n constructor(opts: EvmIssuanceOptions) {\n this.chain = opts.chain;\n this.publicClient = opts.publicClient;\n const registry = opts.registry ?? maybeCoords(opts.chain)?.mipRegistry;\n if (!registry) throw new Error(`No MIP registry configured for ${opts.chain}`);\n this.registry = registry;\n }\n\n async createCollection(\n signer: WalletClient,\n params: CreateCollectionInput,\n ): Promise<AdapterTxResult & { collection: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.registry,\n abi: EvmMipRegistryABI,\n functionName: \"createCollection\",\n args: [params.name, params.symbol, params.baseUri, BigInt(params.royaltyBps)],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [created] = parseEventLogs({\n abi: EvmMipRegistryABI,\n eventName: \"CollectionCreated\",\n logs: receipt.logs,\n });\n return { txHash, collection: created?.args.collection ?? \"\" };\n }\n\n async mint(signer: WalletClient, params: MintInput): Promise<AdapterTxResult & { tokenId: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"mint\",\n args: [params.recipient as `0x${string}`, params.tokenUri],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [minted] = parseEventLogs({\n abi: EvmMipCollectionABI,\n eventName: \"TokenMinted\",\n logs: receipt.logs,\n });\n return { txHash, tokenId: (minted?.args.tokenId ?? 0n).toString() };\n }\n\n async batchMint(\n signer: WalletClient,\n params: { collection: string; recipients: string[]; tokenUris: string[] },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"batchMint\",\n args: [params.recipients as `0x${string}`[], params.tokenUris],\n });\n return { txHash };\n }\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n"]}
|
package/dist/evm/index.d.cts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { TypedDataDomain, WalletClient, PublicClient } from 'viem';
|
|
2
|
-
import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef, I as IssuanceAdapter, e as CreateCollectionInput, M as MintInput } from '../types-
|
|
2
|
+
import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef, I as IssuanceAdapter, e as CreateCollectionInput, M as MintInput } from '../types-nPIXtCF5.cjs';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* EIP-712 order typing for the Medialane EVM venues — byte-identical to the
|
|
6
|
-
* audited Solidity (contracts/EVM-Marketplace-ERC721/src/Medialane721.sol and
|
|
7
|
-
* the 1155 venue, which shares the type strings; the domain's
|
|
8
|
-
* verifyingContract separates deployments and venues).
|
|
9
|
-
*/
|
|
10
4
|
declare const EVM_ORDER_TYPES: {
|
|
11
5
|
readonly OfferItem: readonly [{
|
|
12
6
|
readonly name: "itemType";
|
|
@@ -63,7 +57,6 @@ declare const EVM_ORDER_TYPES: {
|
|
|
63
57
|
readonly type: "uint256";
|
|
64
58
|
}];
|
|
65
59
|
};
|
|
66
|
-
/** NATIVE=0, ERC20=1, ERC721=2 on the 721 venue; NATIVE=0, ERC20=1, ERC1155=2 on the 1155 venue. */
|
|
67
60
|
type EvmItemType = 0 | 1 | 2;
|
|
68
61
|
interface EvmOfferItem {
|
|
69
62
|
itemType: EvmItemType;
|
|
@@ -85,8 +78,6 @@ interface EvmOrderParameters {
|
|
|
85
78
|
counter: bigint;
|
|
86
79
|
}
|
|
87
80
|
declare function evmOrderDomain(chainId: number, verifyingContract: `0x${string}`): TypedDataDomain;
|
|
88
|
-
/** The order's EIP-712 digest — the venue's order hash and the platform's
|
|
89
|
-
* canonical order id on EVM chains. */
|
|
90
81
|
declare function evmOrderDigest(chainId: number, verifyingContract: `0x${string}`, parameters: EvmOrderParameters): `0x${string}`;
|
|
91
82
|
|
|
92
83
|
type EvmChain = "ETHEREUM" | "BASE";
|
|
@@ -94,13 +85,9 @@ interface EvmVenueOptions {
|
|
|
94
85
|
chain: EvmChain;
|
|
95
86
|
chainId: number;
|
|
96
87
|
publicClient: PublicClient;
|
|
97
|
-
/** "721" (unique assets) or "1155" (partial fills). */
|
|
98
88
|
variant: "721" | "1155";
|
|
99
|
-
/** Defaults to the chain registry's venue address (populated at deploy). */
|
|
100
89
|
contract?: `0x${string}`;
|
|
101
90
|
}
|
|
102
|
-
/** The Medialane venue adapter for EVM chains — one implementation serves
|
|
103
|
-
* Ethereum and Base (same bytecode; the EIP-712 domain separates them). */
|
|
104
91
|
declare class EvmVenue implements VenueAdapter<WalletClient> {
|
|
105
92
|
readonly chain: Chain;
|
|
106
93
|
private readonly chainId;
|
|
@@ -108,8 +95,6 @@ declare class EvmVenue implements VenueAdapter<WalletClient> {
|
|
|
108
95
|
private readonly publicClient;
|
|
109
96
|
private readonly variant;
|
|
110
97
|
constructor(opts: EvmVenueOptions);
|
|
111
|
-
/** Builds the order struct, signs the EIP-712 digest, and registers it.
|
|
112
|
-
* The digest is the canonical order id on EVM chains. */
|
|
113
98
|
registerOrder(signer: WalletClient, params: RegisterOrderParams): Promise<AdapterTxResult & {
|
|
114
99
|
orderRef: OrderRef;
|
|
115
100
|
}>;
|
|
@@ -122,11 +107,8 @@ declare class EvmVenue implements VenueAdapter<WalletClient> {
|
|
|
122
107
|
getOrderDetails(orderRef: OrderRef): Promise<unknown>;
|
|
123
108
|
getCounter(address: string): Promise<bigint>;
|
|
124
109
|
}
|
|
125
|
-
/** Payment-token sentinel for native ETH (spec §3.2b currency encoding). */
|
|
126
110
|
declare const NATIVE_SENTINEL = "native";
|
|
127
111
|
|
|
128
|
-
/** Minimal venue ABI — verified against Medialane721.sol / Medialane1155.sol.
|
|
129
|
-
* The 1155 venue's fulfillOrder additionally takes a quantity. */
|
|
130
112
|
declare const EvmVenueABI: readonly [{
|
|
131
113
|
readonly name: "registerOrder";
|
|
132
114
|
readonly type: "function";
|
|
@@ -406,8 +388,6 @@ declare const EvmVenue1155ABI: readonly [{
|
|
|
406
388
|
readonly name: "royaltyAmount";
|
|
407
389
|
}];
|
|
408
390
|
}];
|
|
409
|
-
/** MIP issuance — verified against MIPRegistry.sol / MIPCollection.sol (and
|
|
410
|
-
* the editions pair, which shares the registry surface). */
|
|
411
391
|
declare const EvmMipRegistryABI: readonly [{
|
|
412
392
|
readonly name: "createCollection";
|
|
413
393
|
readonly type: "function";
|
|
@@ -588,10 +568,8 @@ declare const EvmMipCollectionABI: readonly [{
|
|
|
588
568
|
interface EvmIssuanceOptions {
|
|
589
569
|
chain: EvmChain;
|
|
590
570
|
publicClient: PublicClient;
|
|
591
|
-
/** Defaults to the chain registry's MIP registry (populated at deploy). */
|
|
592
571
|
registry?: `0x${string}`;
|
|
593
572
|
}
|
|
594
|
-
/** The Mediolano issuance adapter for EVM chains. */
|
|
595
573
|
declare class EvmIssuance implements IssuanceAdapter<WalletClient> {
|
|
596
574
|
readonly chain: Chain;
|
|
597
575
|
private readonly registry;
|
package/dist/evm/index.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { TypedDataDomain, WalletClient, PublicClient } from 'viem';
|
|
2
|
-
import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef, I as IssuanceAdapter, e as CreateCollectionInput, M as MintInput } from '../types-
|
|
2
|
+
import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef, I as IssuanceAdapter, e as CreateCollectionInput, M as MintInput } from '../types-nPIXtCF5.js';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* EIP-712 order typing for the Medialane EVM venues — byte-identical to the
|
|
6
|
-
* audited Solidity (contracts/EVM-Marketplace-ERC721/src/Medialane721.sol and
|
|
7
|
-
* the 1155 venue, which shares the type strings; the domain's
|
|
8
|
-
* verifyingContract separates deployments and venues).
|
|
9
|
-
*/
|
|
10
4
|
declare const EVM_ORDER_TYPES: {
|
|
11
5
|
readonly OfferItem: readonly [{
|
|
12
6
|
readonly name: "itemType";
|
|
@@ -63,7 +57,6 @@ declare const EVM_ORDER_TYPES: {
|
|
|
63
57
|
readonly type: "uint256";
|
|
64
58
|
}];
|
|
65
59
|
};
|
|
66
|
-
/** NATIVE=0, ERC20=1, ERC721=2 on the 721 venue; NATIVE=0, ERC20=1, ERC1155=2 on the 1155 venue. */
|
|
67
60
|
type EvmItemType = 0 | 1 | 2;
|
|
68
61
|
interface EvmOfferItem {
|
|
69
62
|
itemType: EvmItemType;
|
|
@@ -85,8 +78,6 @@ interface EvmOrderParameters {
|
|
|
85
78
|
counter: bigint;
|
|
86
79
|
}
|
|
87
80
|
declare function evmOrderDomain(chainId: number, verifyingContract: `0x${string}`): TypedDataDomain;
|
|
88
|
-
/** The order's EIP-712 digest — the venue's order hash and the platform's
|
|
89
|
-
* canonical order id on EVM chains. */
|
|
90
81
|
declare function evmOrderDigest(chainId: number, verifyingContract: `0x${string}`, parameters: EvmOrderParameters): `0x${string}`;
|
|
91
82
|
|
|
92
83
|
type EvmChain = "ETHEREUM" | "BASE";
|
|
@@ -94,13 +85,9 @@ interface EvmVenueOptions {
|
|
|
94
85
|
chain: EvmChain;
|
|
95
86
|
chainId: number;
|
|
96
87
|
publicClient: PublicClient;
|
|
97
|
-
/** "721" (unique assets) or "1155" (partial fills). */
|
|
98
88
|
variant: "721" | "1155";
|
|
99
|
-
/** Defaults to the chain registry's venue address (populated at deploy). */
|
|
100
89
|
contract?: `0x${string}`;
|
|
101
90
|
}
|
|
102
|
-
/** The Medialane venue adapter for EVM chains — one implementation serves
|
|
103
|
-
* Ethereum and Base (same bytecode; the EIP-712 domain separates them). */
|
|
104
91
|
declare class EvmVenue implements VenueAdapter<WalletClient> {
|
|
105
92
|
readonly chain: Chain;
|
|
106
93
|
private readonly chainId;
|
|
@@ -108,8 +95,6 @@ declare class EvmVenue implements VenueAdapter<WalletClient> {
|
|
|
108
95
|
private readonly publicClient;
|
|
109
96
|
private readonly variant;
|
|
110
97
|
constructor(opts: EvmVenueOptions);
|
|
111
|
-
/** Builds the order struct, signs the EIP-712 digest, and registers it.
|
|
112
|
-
* The digest is the canonical order id on EVM chains. */
|
|
113
98
|
registerOrder(signer: WalletClient, params: RegisterOrderParams): Promise<AdapterTxResult & {
|
|
114
99
|
orderRef: OrderRef;
|
|
115
100
|
}>;
|
|
@@ -122,11 +107,8 @@ declare class EvmVenue implements VenueAdapter<WalletClient> {
|
|
|
122
107
|
getOrderDetails(orderRef: OrderRef): Promise<unknown>;
|
|
123
108
|
getCounter(address: string): Promise<bigint>;
|
|
124
109
|
}
|
|
125
|
-
/** Payment-token sentinel for native ETH (spec §3.2b currency encoding). */
|
|
126
110
|
declare const NATIVE_SENTINEL = "native";
|
|
127
111
|
|
|
128
|
-
/** Minimal venue ABI — verified against Medialane721.sol / Medialane1155.sol.
|
|
129
|
-
* The 1155 venue's fulfillOrder additionally takes a quantity. */
|
|
130
112
|
declare const EvmVenueABI: readonly [{
|
|
131
113
|
readonly name: "registerOrder";
|
|
132
114
|
readonly type: "function";
|
|
@@ -406,8 +388,6 @@ declare const EvmVenue1155ABI: readonly [{
|
|
|
406
388
|
readonly name: "royaltyAmount";
|
|
407
389
|
}];
|
|
408
390
|
}];
|
|
409
|
-
/** MIP issuance — verified against MIPRegistry.sol / MIPCollection.sol (and
|
|
410
|
-
* the editions pair, which shares the registry surface). */
|
|
411
391
|
declare const EvmMipRegistryABI: readonly [{
|
|
412
392
|
readonly name: "createCollection";
|
|
413
393
|
readonly type: "function";
|
|
@@ -588,10 +568,8 @@ declare const EvmMipCollectionABI: readonly [{
|
|
|
588
568
|
interface EvmIssuanceOptions {
|
|
589
569
|
chain: EvmChain;
|
|
590
570
|
publicClient: PublicClient;
|
|
591
|
-
/** Defaults to the chain registry's MIP registry (populated at deploy). */
|
|
592
571
|
registry?: `0x${string}`;
|
|
593
572
|
}
|
|
594
|
-
/** The Mediolano issuance adapter for EVM chains. */
|
|
595
573
|
declare class EvmIssuance implements IssuanceAdapter<WalletClient> {
|
|
596
574
|
readonly chain: Chain;
|
|
597
575
|
private readonly registry;
|
package/dist/evm/index.js
CHANGED
|
@@ -75,11 +75,6 @@ var COORDINATES = {
|
|
|
75
75
|
ipClubFactoryClassHash: "0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266",
|
|
76
76
|
ipClubCollectionClassHash: "0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5",
|
|
77
77
|
ipClubFactoryStartBlock: 11928775,
|
|
78
|
-
// v3 redesign (deployed 2026-07-15): single contract is both the
|
|
79
|
-
// offer/bid/proposal registry and the license collection (embeds
|
|
80
|
-
// ERC721Component directly) — no separate receipt contract, no
|
|
81
|
-
// set_minter bootstrap. Supersedes the 2026-07-02 v2 address, which had
|
|
82
|
-
// zero offers/licenses ever issued (clean cutover, no reclassification).
|
|
83
78
|
ipSponsorship: "0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c",
|
|
84
79
|
ipSponsorshipClassHash: "0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3",
|
|
85
80
|
ipSponsorshipStartBlock: 11896456,
|
|
@@ -140,8 +135,6 @@ var EvmVenue = class {
|
|
|
140
135
|
if (!contract) throw new Error(`No ${opts.variant} venue configured for ${opts.chain}`);
|
|
141
136
|
this.contract = contract;
|
|
142
137
|
}
|
|
143
|
-
/** Builds the order struct, signs the EIP-712 digest, and registers it.
|
|
144
|
-
* The digest is the canonical order id on EVM chains. */
|
|
145
138
|
async registerOrder(signer, params) {
|
|
146
139
|
const account = signer.account;
|
|
147
140
|
if (!account) throw new Error("WalletClient has no account");
|
package/dist/evm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/evm/typedData.ts","../../src/chains.ts","../../src/evm/abis.ts","../../src/evm/venue.ts","../../src/evm/issuance.ts"],"names":["maybeCoords"],"mappings":";;;AASO,IAAM,eAAA,GAAkB;AAAA,EAC7B,SAAA,EAAW;AAAA,IACT,EAAE,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,OAAA,EAAQ;AAAA,IAClC,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA,EAAU;AAAA,IACjC,EAAE,IAAA,EAAM,YAAA,EAAc,IAAA,EAAM,SAAA,EAAU;AAAA,IAC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,0BAA0B,EAAE,IAAA,EAAM,QAAQ,CAAA;AAClF,IAAA,MAAM,CAAC,MAAM,CAAA,GAAI,cAAA,CAAe;AAAA,MAC9B,GAAA,EAAK,mBAAA;AAAA,MACL,SAAA,EAAW,aAAA;AAAA,MACX,MAAM,OAAA,CAAQ;AAAA,KACf,CAAA;AACD,IAAA,OAAO,EAAE,QAAQ,OAAA,EAAA,CAAU,MAAA,EAAQ,KAAK,OAAA,IAAW,EAAA,EAAI,UAAS,EAAE;AAAA,EACpE;AAAA,EAEA,MAAM,SAAA,CACJ,MAAA,EACA,MAAA,EAC0B;AAC1B,IAAA,MAAM,UAAU,MAAA,CAAO,OAAA;AACvB,IAAA,IAAI,CAAC,OAAA,EAAS,MAAM,IAAI,MAAM,6BAA6B,CAAA;AAC3D,IAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,aAAA,CAAc;AAAA,MACxC,OAAA;AAAA,MACA,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,SAAS,MAAA,CAAO,UAAA;AAAA,MAChB,GAAA,EAAK,mBAAA;AAAA,MACL,YAAA,EAAc,WAAA;AAAA,MACd,IAAA,EAAM,CAAC,MAAA,CAAO,UAAA,EAA+B,OAAO,SAAS;AAAA,KAC9D,CAAA;AACD,IAAA,OAAO,EAAE,MAAA,EAAO;AAAA,EAClB;AACF;AAEA,SAASA,aAAY,KAAA,EAA6C;AAChE,EAAA,IAAI;AACF,IAAA,OAAO,eAAe,KAAK,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF","file":"index.js","sourcesContent":["import { hashTypedData, type TypedDataDomain } from \"viem\";\n\n/**\n * EIP-712 order typing for the Medialane EVM venues — byte-identical to the\n * audited Solidity (contracts/EVM-Marketplace-ERC721/src/Medialane721.sol and\n * the 1155 venue, which shares the type strings; the domain's\n * verifyingContract separates deployments and venues).\n */\n\nexport const EVM_ORDER_TYPES = {\n OfferItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n ConsiderationItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"recipient\", type: \"address\" },\n ],\n OrderParameters: [\n { name: \"offerer\", type: \"address\" },\n { name: \"offer\", type: \"OfferItem\" },\n { name: \"consideration\", type: \"ConsiderationItem\" },\n { name: \"royaltyMaxBps\", type: \"uint256\" },\n { name: \"startTime\", type: \"uint256\" },\n { name: \"endTime\", type: \"uint256\" },\n { name: \"salt\", type: \"uint256\" },\n { name: \"counter\", type: \"uint256\" },\n ],\n} as const;\n\n/** NATIVE=0, ERC20=1, ERC721=2 on the 721 venue; NATIVE=0, ERC20=1, ERC1155=2 on the 1155 venue. */\nexport type EvmItemType = 0 | 1 | 2;\n\nexport interface EvmOfferItem {\n itemType: EvmItemType;\n token: `0x${string}`;\n identifier: bigint;\n amount: bigint;\n}\n\nexport interface EvmConsiderationItem extends EvmOfferItem {\n recipient: `0x${string}`;\n}\n\nexport interface EvmOrderParameters {\n offerer: `0x${string}`;\n offer: EvmOfferItem;\n consideration: EvmConsiderationItem;\n royaltyMaxBps: bigint;\n startTime: bigint;\n endTime: bigint;\n salt: bigint;\n counter: bigint;\n}\n\nexport function evmOrderDomain(chainId: number, verifyingContract: `0x${string}`): TypedDataDomain {\n return { name: \"Medialane\", version: \"1\", chainId, verifyingContract };\n}\n\n/** The order's EIP-712 digest — the venue's order hash and the platform's\n * canonical order id on EVM chains. */\nexport function evmOrderDigest(\n chainId: number,\n verifyingContract: `0x${string}`,\n parameters: EvmOrderParameters,\n): `0x${string}` {\n return hashTypedData({\n domain: evmOrderDomain(chainId, verifyingContract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: parameters,\n });\n}\n","// Single source of per-chain coordinates for Medialane's own services\n// (spec 2026-06-13 §3.1, Decision A). Keyed by CHAIN ALONE — Medialane is\n// mainnet-only, so there is no network axis (refines decisions.md D-9).\n\n/** Mirrors the backend Prisma `Chain` enum. */\nexport const CHAINS = [\"STARKNET\", \"ETHEREUM\", \"SOLANA\", \"BASE\", \"STELLAR\", \"BITCOIN\"] as const;\nexport type Chain = (typeof CHAINS)[number];\n\n/** Starknet coordinates of Medialane services + venues. All fields optional\n * because not every service exists on every chain. */\nexport interface StarknetCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721ClassHash?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155ClassHash?: `0x${string}`;\n marketplace1155StartBlock?: number;\n collection721?: `0x${string}`;\n collection721StartBlock?: number;\n ipNftClassHash?: `0x${string}`;\n ipCollectionClassHash?: `0x${string}`;\n collection1155?: `0x${string}`;\n collection1155FactoryClassHash?: `0x${string}`;\n collection1155ClassHash?: `0x${string}`;\n collection1155StartBlock?: number;\n popFactory?: `0x${string}`;\n popCollectionClassHash?: `0x${string}`;\n dropFactory?: `0x${string}`;\n dropCollectionClassHash?: `0x${string}`;\n nftComments?: `0x${string}`;\n creatorCoinFactory?: `0x${string}`;\n creatorCoinEkuboLauncher?: `0x${string}`;\n creatorCoinClassHash?: `0x${string}`;\n creatorCoinFactoryClassHash?: `0x${string}`;\n creatorCoinStartBlock?: number;\n ekuboCore?: `0x${string}`;\n ipTicketsFactory?: `0x${string}`;\n ipTicketCollectionClassHash?: `0x${string}`;\n ipTicketsFactoryClassHash?: `0x${string}`;\n ipTicketsStartBlock?: number;\n ipClubFactory?: `0x${string}`;\n ipClubFactoryClassHash?: `0x${string}`;\n ipClubCollectionClassHash?: `0x${string}`;\n ipClubFactoryStartBlock?: number;\n ipSponsorship?: `0x${string}`;\n ipSponsorshipClassHash?: `0x${string}`;\n ipSponsorshipStartBlock?: number;\n mediaWalletClassHash?: `0x${string}`;\n}\n\n/** Coordinates per chain. Only STARKNET is populated today; adding a chain\n * means adding an entry here (litmus test, spec §7). */\n/** EVM coordinates — one shape for Ethereum and Base (same bytecode, two\n * chains). Populated at deploy time (federation Phase 4). */\nexport interface EvmCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155StartBlock?: number;\n mipRegistry?: `0x${string}`;\n mipRegistryStartBlock?: number;\n mipEditionsRegistry?: `0x${string}`;\n mipEditionsRegistryStartBlock?: number;\n}\n\n/** Solana coordinates — base58 program ids. Populated at deploy time. */\nexport interface SolanaCoordinates {\n rpcUrl: string;\n mipCollectionsProgram?: string;\n marketplaceProgram?: string;\n startSlot?: number;\n}\n\n/** Stellar (Soroban) coordinates — strkey contract ids. Populated at deploy\n * time; the registry takes the collection WASM hash as a constructor arg. */\nexport interface StellarCoordinates {\n rpcUrl: string;\n mipRegistry?: string;\n marketplace?: string;\n collectionWasmHash?: string;\n startLedger?: number;\n}\n\n/** Per-chain coordinate shapes. Every chain is an equal entry — no chain is\n * privileged in core (chain-sovereignty I2/I4). */\nexport interface CoordinatesByChain {\n STARKNET?: StarknetCoordinates;\n ETHEREUM?: EvmCoordinates;\n BASE?: EvmCoordinates;\n SOLANA?: SolanaCoordinates;\n STELLAR?: StellarCoordinates;\n BITCOIN?: never;\n}\n\n/** @deprecated Renamed — use `StarknetCoordinates` (coordinates are per-chain-shaped). */\nexport type ChainCoordinates = StarknetCoordinates;\n\nconst COORDINATES: CoordinatesByChain = {\n STARKNET: {\n rpcUrl: \"https://rpc.starknet.lava.build\",\n marketplace721: \"0x03eda9a2b6ad90845a43591bac8083ebaf677d51fdf20f503b2c01889e3131fc\",\n marketplace721ClassHash: \"0x0700d9230d07e5203e27778c0dc70f9134d2b25bf319f7cf8348dc66a6923e90\",\n marketplace721StartBlock: 11198146,\n marketplace1155: \"0x07c4ce1c19ea48cc11135ed22b19ff745f5aec508c3828593002e4f76fdb1b38\",\n marketplace1155ClassHash: \"0x0242f5c388da7cee2d99e2a69453c8159bf927fbec4e797a3cfdcbbcb5b68328\",\n marketplace1155StartBlock: 11198267,\n collection721: \"0x0225c3ae09506b8d97adc39649ca740dad5aac195b7f5f0441cc1852947acaea\",\n collection721StartBlock: 11198496,\n ipNftClassHash: \"0x012d3ae40ba35c7e2be0946532dac60e48932447912fdf96b674da67c029b9cc\",\n ipCollectionClassHash: \"0x022155a1a130a40e57aac4b89c07fab3f616bc351b1270fc40f756b963afe8b4\",\n collection1155: \"0x015368976d46fae5bfa1c58600f641d5aa5dbbf53ebc6b78aa3922194aad3551\",\n collection1155FactoryClassHash: \"0x04eb6b419770f13bd191f120b9fc9ee624c0613ad4490062d293ca2016b3b1d2\",\n collection1155ClassHash: \"0x06cf3f5a2322dac35e07a6064a5b8802f19fda8aa3f4726f0cb7bc05dea1bd78\",\n collection1155StartBlock: 11199527,\n popFactory: \"0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111\",\n popCollectionClassHash: \"0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f\",\n dropFactory: \"0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800\",\n dropCollectionClassHash: \"0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282\",\n nftComments: \"0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843\",\n creatorCoinFactory: \"0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c\",\n creatorCoinEkuboLauncher: \"0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4\",\n creatorCoinClassHash: \"0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6\",\n creatorCoinFactoryClassHash: \"0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55\",\n creatorCoinStartBlock: 10474544,\n ekuboCore: \"0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b\",\n ipTicketsFactory: \"0x0767bf5b57e1f812463159b5ed683183e1b0c3f942b74871b5c6cd6a93c15e99\",\n ipTicketCollectionClassHash: \"0x0449e8eb7c117740d07cb8e0157d32c8ba3d19d1cfd2784ed5e139f5a1e04acc\",\n ipTicketsFactoryClassHash: \"0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a\",\n ipTicketsStartBlock: 11933694,\n ipClubFactory: \"0x06a0b0be16d70c78f2e18119dbf90e5911cbfd5d8d484bc555dc61d96f56a2b9\",\n ipClubFactoryClassHash: \"0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266\",\n ipClubCollectionClassHash: \"0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5\",\n ipClubFactoryStartBlock: 11928775,\n // v3 redesign (deployed 2026-07-15): single contract is both the\n // offer/bid/proposal registry and the license collection (embeds\n // ERC721Component directly) — no separate receipt contract, no\n // set_minter bootstrap. Supersedes the 2026-07-02 v2 address, which had\n // zero offers/licenses ever issued (clean cutover, no reclassification).\n ipSponsorship: \"0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c\",\n ipSponsorshipClassHash: \"0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3\",\n ipSponsorshipStartBlock: 11896456,\n mediaWalletClassHash: \"0x014b210c7d47392691144bafecdca3c6c7791cc295ea305988da0a724c05ac31\",\n },\n};\n\nexport function getCoordinates(chain: \"STARKNET\"): StarknetCoordinates;\nexport function getCoordinates(chain: \"ETHEREUM\" | \"BASE\"): EvmCoordinates;\nexport function getCoordinates(chain: \"SOLANA\"): SolanaCoordinates;\nexport function getCoordinates(chain: \"STELLAR\"): StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates {\n const c = COORDINATES[chain];\n if (!c) throw new Error(`No coordinates configured for chain \"${chain}\"`);\n return c;\n}\n\nexport const DEFAULT_CHAIN: Chain = \"STARKNET\";\n\n/** Typed Starknet coordinates for Starknet-only modules; throws when the\n * client is scoped to another chain. */\nexport function getStarknetCoordinates(chain: Chain): StarknetCoordinates {\n if (chain !== \"STARKNET\") {\n throw new Error(`This module is Starknet-only (client chain: \"${chain}\")`);\n }\n return getCoordinates(\"STARKNET\");\n}\n","import { parseAbi } from \"viem\";\n\n/** Minimal venue ABI — verified against Medialane721.sol / Medialane1155.sol.\n * The 1155 venue's fulfillOrder additionally takes a quantity. */\nexport const EvmVenueABI = parseAbi([\n \"struct OfferItem { uint8 itemType; address token; uint256 identifier; uint256 amount; }\",\n \"struct ConsiderationItem { uint8 itemType; address token; uint256 identifier; uint256 amount; address recipient; }\",\n \"struct OrderParameters { address offerer; OfferItem offer; ConsiderationItem consideration; uint256 royaltyMaxBps; uint256 startTime; uint256 endTime; uint256 salt; uint256 counter; }\",\n \"function registerOrder(OrderParameters parameters, bytes signature)\",\n \"function fulfillOrder(bytes32 orderHash) payable\",\n \"function cancelOrder(bytes32 orderHash)\",\n \"function incrementCounter()\",\n \"function getOrderHash(OrderParameters parameters) view returns (bytes32)\",\n \"function getCounter(address offerer) view returns (uint256)\",\n \"function version() pure returns (string)\",\n \"event OrderCreated(bytes32 indexed orderHash, address indexed offerer)\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n \"event OrderCancelled(bytes32 indexed orderHash, address indexed offerer)\",\n \"event CounterIncremented(address indexed offerer, uint256 newCounter)\",\n]);\n\nexport const EvmVenue1155ABI = parseAbi([\n \"function fulfillOrder(bytes32 orderHash, uint256 quantity) payable\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 quantity, uint256 remainingAmount, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n]);\n\n/** MIP issuance — verified against MIPRegistry.sol / MIPCollection.sol (and\n * the editions pair, which shares the registry surface). */\nexport const EvmMipRegistryABI = parseAbi([\n \"function createCollection(string name, string symbol, string baseUri, uint96 royaltyBps) returns (uint256 collectionId, address collection)\",\n \"function getCollection(uint256 collectionId) view returns (address collection, address creator)\",\n \"function collectionCount() view returns (uint256)\",\n \"event CollectionCreated(uint256 indexed collectionId, address indexed collection, address indexed creator, string name, string symbol, string baseUri)\",\n]);\n\nexport const EvmMipCollectionABI = parseAbi([\n \"function mint(address to, string metadataUri) returns (uint256 tokenId)\",\n \"function batchMint(address[] to, string[] metadataUris) returns (uint256[] tokenIds)\",\n \"function tokenURI(uint256 tokenId) view returns (string)\",\n \"function ownerOf(uint256 tokenId) view returns (address)\",\n \"function balanceOf(address owner) view returns (uint256)\",\n \"function owner() view returns (address)\",\n \"event TokenMinted(uint256 indexed tokenId, address indexed owner, string metadataUri)\",\n \"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)\",\n]);\n","import type { PublicClient, WalletClient } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type {\n AdapterTxResult,\n OrderRef,\n RegisterOrderParams,\n VenueAdapter,\n} from \"../adapters/types.js\";\nimport { EvmVenueABI, EvmVenue1155ABI } from \"./abis.js\";\nimport {\n EVM_ORDER_TYPES,\n evmOrderDigest,\n evmOrderDomain,\n type EvmOrderParameters,\n} from \"./typedData.js\";\n\nexport type EvmChain = \"ETHEREUM\" | \"BASE\";\n\nexport interface EvmVenueOptions {\n chain: EvmChain;\n chainId: number;\n publicClient: PublicClient;\n /** \"721\" (unique assets) or \"1155\" (partial fills). */\n variant: \"721\" | \"1155\";\n /** Defaults to the chain registry's venue address (populated at deploy). */\n contract?: `0x${string}`;\n}\n\n/** The Medialane venue adapter for EVM chains — one implementation serves\n * Ethereum and Base (same bytecode; the EIP-712 domain separates them). */\nexport class EvmVenue implements VenueAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly chainId: number;\n private readonly contract: `0x${string}`;\n private readonly publicClient: PublicClient;\n private readonly variant: \"721\" | \"1155\";\n\n constructor(opts: EvmVenueOptions) {\n this.chain = opts.chain;\n this.chainId = opts.chainId;\n this.publicClient = opts.publicClient;\n this.variant = opts.variant;\n const coords = maybeCoords(opts.chain);\n const contract =\n opts.contract ?? (opts.variant === \"721\" ? coords?.marketplace721 : coords?.marketplace1155);\n if (!contract) throw new Error(`No ${opts.variant} venue configured for ${opts.chain}`);\n this.contract = contract;\n }\n\n /** Builds the order struct, signs the EIP-712 digest, and registers it.\n * The digest is the canonical order id on EVM chains. */\n async registerOrder(\n signer: WalletClient,\n params: RegisterOrderParams,\n ): Promise<AdapterTxResult & { orderRef: OrderRef }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const counter = await this.getCounter(account.address);\n const nft = {\n itemType: 2 as const,\n token: params.asset.contract as `0x${string}`,\n identifier: BigInt(params.asset.tokenId),\n amount: 1n,\n };\n const payment = {\n itemType: (params.paymentToken === NATIVE_SENTINEL ? 0 : 1) as 0 | 1,\n token: (params.paymentToken === NATIVE_SENTINEL\n ? \"0x0000000000000000000000000000000000000000\"\n : params.paymentToken) as `0x${string}`,\n identifier: 0n,\n amount: BigInt(params.amount),\n };\n const order: EvmOrderParameters =\n params.side === \"listing\"\n ? {\n offerer: account.address,\n offer: nft,\n consideration: { ...payment, recipient: account.address },\n ...commonFields(params),\n }\n : {\n offerer: account.address,\n offer: payment,\n consideration: { ...nft, recipient: account.address },\n ...commonFields(params),\n };\n order.counter = counter;\n\n const signature = await signer.signTypedData({\n account,\n domain: evmOrderDomain(this.chainId, this.contract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: order,\n });\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"registerOrder\",\n args: [order, signature],\n });\n return { txHash, orderRef: evmOrderDigest(this.chainId, this.contract, order) };\n }\n\n async fulfillOrder(\n signer: WalletClient,\n orderRef: OrderRef,\n opts?: { quantity?: string; value?: string },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const value = opts?.value ? BigInt(opts.value) : undefined;\n const txHash =\n this.variant === \"1155\"\n ? await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenue1155ABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`, BigInt(opts?.quantity ?? \"1\")],\n value,\n })\n : await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`],\n value,\n });\n return { txHash };\n }\n\n async cancelOrder(signer: WalletClient, orderRef: OrderRef): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"cancelOrder\",\n args: [orderRef as `0x${string}`],\n });\n return { txHash };\n }\n\n async incrementCounter(signer: WalletClient): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"incrementCounter\",\n args: [],\n });\n return { txHash };\n }\n\n async getOrderDetails(orderRef: OrderRef): Promise<unknown> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: [\n {\n type: \"function\",\n name: \"getOrderDetails\",\n stateMutability: \"view\",\n inputs: [{ name: \"orderHash\", type: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"bytes\" }],\n },\n ] as const,\n functionName: \"getOrderDetails\",\n args: [orderRef as `0x${string}`],\n });\n }\n\n async getCounter(address: string): Promise<bigint> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"getCounter\",\n args: [address as `0x${string}`],\n });\n }\n}\n\n/** Payment-token sentinel for native ETH (spec §3.2b currency encoding). */\nexport const NATIVE_SENTINEL = \"native\";\n\nfunction commonFields(params: RegisterOrderParams) {\n return {\n royaltyMaxBps: BigInt(params.royaltyMaxBps),\n startTime: BigInt(params.startTime),\n endTime: BigInt(params.endTime),\n salt: BigInt(params.salt),\n counter: 0n,\n };\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n","import type { PublicClient, WalletClient } from \"viem\";\nimport { parseEventLogs } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type { AdapterTxResult, CreateCollectionInput, IssuanceAdapter, MintInput } from \"../adapters/types.js\";\nimport { EvmMipCollectionABI, EvmMipRegistryABI } from \"./abis.js\";\nimport type { EvmChain } from \"./venue.js\";\n\nexport interface EvmIssuanceOptions {\n chain: EvmChain;\n publicClient: PublicClient;\n /** Defaults to the chain registry's MIP registry (populated at deploy). */\n registry?: `0x${string}`;\n}\n\n/** The Mediolano issuance adapter for EVM chains. */\nexport class EvmIssuance implements IssuanceAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly registry: `0x${string}`;\n private readonly publicClient: PublicClient;\n\n constructor(opts: EvmIssuanceOptions) {\n this.chain = opts.chain;\n this.publicClient = opts.publicClient;\n const registry = opts.registry ?? maybeCoords(opts.chain)?.mipRegistry;\n if (!registry) throw new Error(`No MIP registry configured for ${opts.chain}`);\n this.registry = registry;\n }\n\n async createCollection(\n signer: WalletClient,\n params: CreateCollectionInput,\n ): Promise<AdapterTxResult & { collection: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.registry,\n abi: EvmMipRegistryABI,\n functionName: \"createCollection\",\n args: [params.name, params.symbol, params.baseUri, BigInt(params.royaltyBps)],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [created] = parseEventLogs({\n abi: EvmMipRegistryABI,\n eventName: \"CollectionCreated\",\n logs: receipt.logs,\n });\n return { txHash, collection: created?.args.collection ?? \"\" };\n }\n\n async mint(signer: WalletClient, params: MintInput): Promise<AdapterTxResult & { tokenId: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"mint\",\n args: [params.recipient as `0x${string}`, params.tokenUri],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [minted] = parseEventLogs({\n abi: EvmMipCollectionABI,\n eventName: \"TokenMinted\",\n logs: receipt.logs,\n });\n return { txHash, tokenId: (minted?.args.tokenId ?? 0n).toString() };\n }\n\n async batchMint(\n signer: WalletClient,\n params: { collection: string; recipients: string[]; tokenUris: string[] },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"batchMint\",\n args: [params.recipients as `0x${string}`[], params.tokenUris],\n });\n return { txHash };\n }\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/evm/typedData.ts","../../src/chains.ts","../../src/evm/abis.ts","../../src/evm/venue.ts","../../src/evm/issuance.ts"],"names":["maybeCoords"],"mappings":";;;AAEO,IAAM,eAAA,GAAkB;AAAA,EAC7B,SAAA,EAAW;AAAA,IACT,EAAE,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,OAAA,EAAQ;AAAA,IAClC,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,QAAQ;AAAA,KAC1D,CAAA;AACD,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,CAAa,0BAA0B,EAAE,IAAA,EAAM,QAAQ,CAAA;AAClF,IAAA,MAAM,CAAC,MAAM,CAAA,GAAI,cAAA,CAAe;AAAA,MAC9B,GAAA,EAAK,mBAAA;AAAA,MACL,SAAA,EAAW,aAAA;AAAA,MACX,MAAM,OAAA,CAAQ;AAAA,KACf,CAAA;AACD,IAAA,OAAO,EAAE,QAAQ,OAAA,EAAA,CAAU,MAAA,EAAQ,KAAK,OAAA,IAAW,EAAA,EAAI,UAAS,EAAE;AAAA,EACpE;AAAA,EAEA,MAAM,SAAA,CACJ,MAAA,EACA,MAAA,EAC0B;AAC1B,IAAA,MAAM,UAAU,MAAA,CAAO,OAAA;AACvB,IAAA,IAAI,CAAC,OAAA,EAAS,MAAM,IAAI,MAAM,6BAA6B,CAAA;AAC3D,IAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,aAAA,CAAc;AAAA,MACxC,OAAA;AAAA,MACA,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,SAAS,MAAA,CAAO,UAAA;AAAA,MAChB,GAAA,EAAK,mBAAA;AAAA,MACL,YAAA,EAAc,WAAA;AAAA,MACd,IAAA,EAAM,CAAC,MAAA,CAAO,UAAA,EAA+B,OAAO,SAAS;AAAA,KAC9D,CAAA;AACD,IAAA,OAAO,EAAE,MAAA,EAAO;AAAA,EAClB;AACF;AAEA,SAASA,aAAY,KAAA,EAA6C;AAChE,EAAA,IAAI;AACF,IAAA,OAAO,eAAe,KAAK,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF","file":"index.js","sourcesContent":["import { hashTypedData, type TypedDataDomain } from \"viem\";\n\nexport const EVM_ORDER_TYPES = {\n OfferItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n ConsiderationItem: [\n { name: \"itemType\", type: \"uint8\" },\n { name: \"token\", type: \"address\" },\n { name: \"identifier\", type: \"uint256\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"recipient\", type: \"address\" },\n ],\n OrderParameters: [\n { name: \"offerer\", type: \"address\" },\n { name: \"offer\", type: \"OfferItem\" },\n { name: \"consideration\", type: \"ConsiderationItem\" },\n { name: \"royaltyMaxBps\", type: \"uint256\" },\n { name: \"startTime\", type: \"uint256\" },\n { name: \"endTime\", type: \"uint256\" },\n { name: \"salt\", type: \"uint256\" },\n { name: \"counter\", type: \"uint256\" },\n ],\n} as const;\n\nexport type EvmItemType = 0 | 1 | 2;\n\nexport interface EvmOfferItem {\n itemType: EvmItemType;\n token: `0x${string}`;\n identifier: bigint;\n amount: bigint;\n}\n\nexport interface EvmConsiderationItem extends EvmOfferItem {\n recipient: `0x${string}`;\n}\n\nexport interface EvmOrderParameters {\n offerer: `0x${string}`;\n offer: EvmOfferItem;\n consideration: EvmConsiderationItem;\n royaltyMaxBps: bigint;\n startTime: bigint;\n endTime: bigint;\n salt: bigint;\n counter: bigint;\n}\n\nexport function evmOrderDomain(chainId: number, verifyingContract: `0x${string}`): TypedDataDomain {\n return { name: \"Medialane\", version: \"1\", chainId, verifyingContract };\n}\n\nexport function evmOrderDigest(\n chainId: number,\n verifyingContract: `0x${string}`,\n parameters: EvmOrderParameters,\n): `0x${string}` {\n return hashTypedData({\n domain: evmOrderDomain(chainId, verifyingContract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: parameters,\n });\n}\n","\n\nexport const CHAINS = [\"STARKNET\", \"ETHEREUM\", \"SOLANA\", \"BASE\", \"STELLAR\", \"BITCOIN\"] as const;\nexport type Chain = (typeof CHAINS)[number];\n\nexport interface StarknetCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721ClassHash?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155ClassHash?: `0x${string}`;\n marketplace1155StartBlock?: number;\n collection721?: `0x${string}`;\n collection721StartBlock?: number;\n ipNftClassHash?: `0x${string}`;\n ipCollectionClassHash?: `0x${string}`;\n collection1155?: `0x${string}`;\n collection1155FactoryClassHash?: `0x${string}`;\n collection1155ClassHash?: `0x${string}`;\n collection1155StartBlock?: number;\n popFactory?: `0x${string}`;\n popCollectionClassHash?: `0x${string}`;\n dropFactory?: `0x${string}`;\n dropCollectionClassHash?: `0x${string}`;\n nftComments?: `0x${string}`;\n creatorCoinFactory?: `0x${string}`;\n creatorCoinEkuboLauncher?: `0x${string}`;\n creatorCoinClassHash?: `0x${string}`;\n creatorCoinFactoryClassHash?: `0x${string}`;\n creatorCoinStartBlock?: number;\n ekuboCore?: `0x${string}`;\n ipTicketsFactory?: `0x${string}`;\n ipTicketCollectionClassHash?: `0x${string}`;\n ipTicketsFactoryClassHash?: `0x${string}`;\n ipTicketsStartBlock?: number;\n ipClubFactory?: `0x${string}`;\n ipClubFactoryClassHash?: `0x${string}`;\n ipClubCollectionClassHash?: `0x${string}`;\n ipClubFactoryStartBlock?: number;\n ipSponsorship?: `0x${string}`;\n ipSponsorshipClassHash?: `0x${string}`;\n ipSponsorshipStartBlock?: number;\n mediaWalletClassHash?: `0x${string}`;\n}\n\nexport interface EvmCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155StartBlock?: number;\n mipRegistry?: `0x${string}`;\n mipRegistryStartBlock?: number;\n mipEditionsRegistry?: `0x${string}`;\n mipEditionsRegistryStartBlock?: number;\n}\n\nexport interface SolanaCoordinates {\n rpcUrl: string;\n mipCollectionsProgram?: string;\n marketplaceProgram?: string;\n startSlot?: number;\n}\n\nexport interface StellarCoordinates {\n rpcUrl: string;\n mipRegistry?: string;\n marketplace?: string;\n collectionWasmHash?: string;\n startLedger?: number;\n}\n\nexport interface CoordinatesByChain {\n STARKNET?: StarknetCoordinates;\n ETHEREUM?: EvmCoordinates;\n BASE?: EvmCoordinates;\n SOLANA?: SolanaCoordinates;\n STELLAR?: StellarCoordinates;\n BITCOIN?: never;\n}\n\nexport type ChainCoordinates = StarknetCoordinates;\n\nconst COORDINATES: CoordinatesByChain = {\n STARKNET: {\n rpcUrl: \"https://rpc.starknet.lava.build\",\n marketplace721: \"0x03eda9a2b6ad90845a43591bac8083ebaf677d51fdf20f503b2c01889e3131fc\",\n marketplace721ClassHash: \"0x0700d9230d07e5203e27778c0dc70f9134d2b25bf319f7cf8348dc66a6923e90\",\n marketplace721StartBlock: 11198146,\n marketplace1155: \"0x07c4ce1c19ea48cc11135ed22b19ff745f5aec508c3828593002e4f76fdb1b38\",\n marketplace1155ClassHash: \"0x0242f5c388da7cee2d99e2a69453c8159bf927fbec4e797a3cfdcbbcb5b68328\",\n marketplace1155StartBlock: 11198267,\n collection721: \"0x0225c3ae09506b8d97adc39649ca740dad5aac195b7f5f0441cc1852947acaea\",\n collection721StartBlock: 11198496,\n ipNftClassHash: \"0x012d3ae40ba35c7e2be0946532dac60e48932447912fdf96b674da67c029b9cc\",\n ipCollectionClassHash: \"0x022155a1a130a40e57aac4b89c07fab3f616bc351b1270fc40f756b963afe8b4\",\n collection1155: \"0x015368976d46fae5bfa1c58600f641d5aa5dbbf53ebc6b78aa3922194aad3551\",\n collection1155FactoryClassHash: \"0x04eb6b419770f13bd191f120b9fc9ee624c0613ad4490062d293ca2016b3b1d2\",\n collection1155ClassHash: \"0x06cf3f5a2322dac35e07a6064a5b8802f19fda8aa3f4726f0cb7bc05dea1bd78\",\n collection1155StartBlock: 11199527,\n popFactory: \"0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111\",\n popCollectionClassHash: \"0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f\",\n dropFactory: \"0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800\",\n dropCollectionClassHash: \"0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282\",\n nftComments: \"0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843\",\n creatorCoinFactory: \"0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c\",\n creatorCoinEkuboLauncher: \"0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4\",\n creatorCoinClassHash: \"0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6\",\n creatorCoinFactoryClassHash: \"0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55\",\n creatorCoinStartBlock: 10474544,\n ekuboCore: \"0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b\",\n ipTicketsFactory: \"0x0767bf5b57e1f812463159b5ed683183e1b0c3f942b74871b5c6cd6a93c15e99\",\n ipTicketCollectionClassHash: \"0x0449e8eb7c117740d07cb8e0157d32c8ba3d19d1cfd2784ed5e139f5a1e04acc\",\n ipTicketsFactoryClassHash: \"0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a\",\n ipTicketsStartBlock: 11933694,\n ipClubFactory: \"0x06a0b0be16d70c78f2e18119dbf90e5911cbfd5d8d484bc555dc61d96f56a2b9\",\n ipClubFactoryClassHash: \"0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266\",\n ipClubCollectionClassHash: \"0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5\",\n ipClubFactoryStartBlock: 11928775,\n\n ipSponsorship: \"0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c\",\n ipSponsorshipClassHash: \"0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3\",\n ipSponsorshipStartBlock: 11896456,\n mediaWalletClassHash: \"0x014b210c7d47392691144bafecdca3c6c7791cc295ea305988da0a724c05ac31\",\n },\n};\n\nexport function getCoordinates(chain: \"STARKNET\"): StarknetCoordinates;\nexport function getCoordinates(chain: \"ETHEREUM\" | \"BASE\"): EvmCoordinates;\nexport function getCoordinates(chain: \"SOLANA\"): SolanaCoordinates;\nexport function getCoordinates(chain: \"STELLAR\"): StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates {\n const c = COORDINATES[chain];\n if (!c) throw new Error(`No coordinates configured for chain \"${chain}\"`);\n return c;\n}\n\nexport const DEFAULT_CHAIN: Chain = \"STARKNET\";\n\nexport function getStarknetCoordinates(chain: Chain): StarknetCoordinates {\n if (chain !== \"STARKNET\") {\n throw new Error(`This module is Starknet-only (client chain: \"${chain}\")`);\n }\n return getCoordinates(\"STARKNET\");\n}\n","import { parseAbi } from \"viem\";\n\nexport const EvmVenueABI = parseAbi([\n \"struct OfferItem { uint8 itemType; address token; uint256 identifier; uint256 amount; }\",\n \"struct ConsiderationItem { uint8 itemType; address token; uint256 identifier; uint256 amount; address recipient; }\",\n \"struct OrderParameters { address offerer; OfferItem offer; ConsiderationItem consideration; uint256 royaltyMaxBps; uint256 startTime; uint256 endTime; uint256 salt; uint256 counter; }\",\n \"function registerOrder(OrderParameters parameters, bytes signature)\",\n \"function fulfillOrder(bytes32 orderHash) payable\",\n \"function cancelOrder(bytes32 orderHash)\",\n \"function incrementCounter()\",\n \"function getOrderHash(OrderParameters parameters) view returns (bytes32)\",\n \"function getCounter(address offerer) view returns (uint256)\",\n \"function version() pure returns (string)\",\n \"event OrderCreated(bytes32 indexed orderHash, address indexed offerer)\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n \"event OrderCancelled(bytes32 indexed orderHash, address indexed offerer)\",\n \"event CounterIncremented(address indexed offerer, uint256 newCounter)\",\n]);\n\nexport const EvmVenue1155ABI = parseAbi([\n \"function fulfillOrder(bytes32 orderHash, uint256 quantity) payable\",\n \"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 quantity, uint256 remainingAmount, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)\",\n]);\n\nexport const EvmMipRegistryABI = parseAbi([\n \"function createCollection(string name, string symbol, string baseUri, uint96 royaltyBps) returns (uint256 collectionId, address collection)\",\n \"function getCollection(uint256 collectionId) view returns (address collection, address creator)\",\n \"function collectionCount() view returns (uint256)\",\n \"event CollectionCreated(uint256 indexed collectionId, address indexed collection, address indexed creator, string name, string symbol, string baseUri)\",\n]);\n\nexport const EvmMipCollectionABI = parseAbi([\n \"function mint(address to, string metadataUri) returns (uint256 tokenId)\",\n \"function batchMint(address[] to, string[] metadataUris) returns (uint256[] tokenIds)\",\n \"function tokenURI(uint256 tokenId) view returns (string)\",\n \"function ownerOf(uint256 tokenId) view returns (address)\",\n \"function balanceOf(address owner) view returns (uint256)\",\n \"function owner() view returns (address)\",\n \"event TokenMinted(uint256 indexed tokenId, address indexed owner, string metadataUri)\",\n \"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)\",\n]);\n","import type { PublicClient, WalletClient } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type {\n AdapterTxResult,\n OrderRef,\n RegisterOrderParams,\n VenueAdapter,\n} from \"../adapters/types.js\";\nimport { EvmVenueABI, EvmVenue1155ABI } from \"./abis.js\";\nimport {\n EVM_ORDER_TYPES,\n evmOrderDigest,\n evmOrderDomain,\n type EvmOrderParameters,\n} from \"./typedData.js\";\n\nexport type EvmChain = \"ETHEREUM\" | \"BASE\";\n\nexport interface EvmVenueOptions {\n chain: EvmChain;\n chainId: number;\n publicClient: PublicClient;\n\n variant: \"721\" | \"1155\";\n\n contract?: `0x${string}`;\n}\n\nexport class EvmVenue implements VenueAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly chainId: number;\n private readonly contract: `0x${string}`;\n private readonly publicClient: PublicClient;\n private readonly variant: \"721\" | \"1155\";\n\n constructor(opts: EvmVenueOptions) {\n this.chain = opts.chain;\n this.chainId = opts.chainId;\n this.publicClient = opts.publicClient;\n this.variant = opts.variant;\n const coords = maybeCoords(opts.chain);\n const contract =\n opts.contract ?? (opts.variant === \"721\" ? coords?.marketplace721 : coords?.marketplace1155);\n if (!contract) throw new Error(`No ${opts.variant} venue configured for ${opts.chain}`);\n this.contract = contract;\n }\n\n async registerOrder(\n signer: WalletClient,\n params: RegisterOrderParams,\n ): Promise<AdapterTxResult & { orderRef: OrderRef }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const counter = await this.getCounter(account.address);\n const nft = {\n itemType: 2 as const,\n token: params.asset.contract as `0x${string}`,\n identifier: BigInt(params.asset.tokenId),\n amount: 1n,\n };\n const payment = {\n itemType: (params.paymentToken === NATIVE_SENTINEL ? 0 : 1) as 0 | 1,\n token: (params.paymentToken === NATIVE_SENTINEL\n ? \"0x0000000000000000000000000000000000000000\"\n : params.paymentToken) as `0x${string}`,\n identifier: 0n,\n amount: BigInt(params.amount),\n };\n const order: EvmOrderParameters =\n params.side === \"listing\"\n ? {\n offerer: account.address,\n offer: nft,\n consideration: { ...payment, recipient: account.address },\n ...commonFields(params),\n }\n : {\n offerer: account.address,\n offer: payment,\n consideration: { ...nft, recipient: account.address },\n ...commonFields(params),\n };\n order.counter = counter;\n\n const signature = await signer.signTypedData({\n account,\n domain: evmOrderDomain(this.chainId, this.contract),\n types: EVM_ORDER_TYPES,\n primaryType: \"OrderParameters\",\n message: order,\n });\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"registerOrder\",\n args: [order, signature],\n });\n return { txHash, orderRef: evmOrderDigest(this.chainId, this.contract, order) };\n }\n\n async fulfillOrder(\n signer: WalletClient,\n orderRef: OrderRef,\n opts?: { quantity?: string; value?: string },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const value = opts?.value ? BigInt(opts.value) : undefined;\n const txHash =\n this.variant === \"1155\"\n ? await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenue1155ABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`, BigInt(opts?.quantity ?? \"1\")],\n value,\n })\n : await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"fulfillOrder\",\n args: [orderRef as `0x${string}`],\n value,\n });\n return { txHash };\n }\n\n async cancelOrder(signer: WalletClient, orderRef: OrderRef): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"cancelOrder\",\n args: [orderRef as `0x${string}`],\n });\n return { txHash };\n }\n\n async incrementCounter(signer: WalletClient): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"incrementCounter\",\n args: [],\n });\n return { txHash };\n }\n\n async getOrderDetails(orderRef: OrderRef): Promise<unknown> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: [\n {\n type: \"function\",\n name: \"getOrderDetails\",\n stateMutability: \"view\",\n inputs: [{ name: \"orderHash\", type: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"bytes\" }],\n },\n ] as const,\n functionName: \"getOrderDetails\",\n args: [orderRef as `0x${string}`],\n });\n }\n\n async getCounter(address: string): Promise<bigint> {\n return this.publicClient.readContract({\n address: this.contract,\n abi: EvmVenueABI,\n functionName: \"getCounter\",\n args: [address as `0x${string}`],\n });\n }\n}\n\nexport const NATIVE_SENTINEL = \"native\";\n\nfunction commonFields(params: RegisterOrderParams) {\n return {\n royaltyMaxBps: BigInt(params.royaltyMaxBps),\n startTime: BigInt(params.startTime),\n endTime: BigInt(params.endTime),\n salt: BigInt(params.salt),\n counter: 0n,\n };\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n","import type { PublicClient, WalletClient } from \"viem\";\nimport { parseEventLogs } from \"viem\";\nimport type { Chain } from \"../chains.js\";\nimport { getCoordinates, type EvmCoordinates } from \"../chains.js\";\nimport type { AdapterTxResult, CreateCollectionInput, IssuanceAdapter, MintInput } from \"../adapters/types.js\";\nimport { EvmMipCollectionABI, EvmMipRegistryABI } from \"./abis.js\";\nimport type { EvmChain } from \"./venue.js\";\n\nexport interface EvmIssuanceOptions {\n chain: EvmChain;\n publicClient: PublicClient;\n\n registry?: `0x${string}`;\n}\n\nexport class EvmIssuance implements IssuanceAdapter<WalletClient> {\n readonly chain: Chain;\n private readonly registry: `0x${string}`;\n private readonly publicClient: PublicClient;\n\n constructor(opts: EvmIssuanceOptions) {\n this.chain = opts.chain;\n this.publicClient = opts.publicClient;\n const registry = opts.registry ?? maybeCoords(opts.chain)?.mipRegistry;\n if (!registry) throw new Error(`No MIP registry configured for ${opts.chain}`);\n this.registry = registry;\n }\n\n async createCollection(\n signer: WalletClient,\n params: CreateCollectionInput,\n ): Promise<AdapterTxResult & { collection: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: this.registry,\n abi: EvmMipRegistryABI,\n functionName: \"createCollection\",\n args: [params.name, params.symbol, params.baseUri, BigInt(params.royaltyBps)],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [created] = parseEventLogs({\n abi: EvmMipRegistryABI,\n eventName: \"CollectionCreated\",\n logs: receipt.logs,\n });\n return { txHash, collection: created?.args.collection ?? \"\" };\n }\n\n async mint(signer: WalletClient, params: MintInput): Promise<AdapterTxResult & { tokenId: string }> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"mint\",\n args: [params.recipient as `0x${string}`, params.tokenUri],\n });\n const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });\n const [minted] = parseEventLogs({\n abi: EvmMipCollectionABI,\n eventName: \"TokenMinted\",\n logs: receipt.logs,\n });\n return { txHash, tokenId: (minted?.args.tokenId ?? 0n).toString() };\n }\n\n async batchMint(\n signer: WalletClient,\n params: { collection: string; recipients: string[]; tokenUris: string[] },\n ): Promise<AdapterTxResult> {\n const account = signer.account;\n if (!account) throw new Error(\"WalletClient has no account\");\n const txHash = await signer.writeContract({\n account,\n chain: signer.chain,\n address: params.collection as `0x${string}`,\n abi: EvmMipCollectionABI,\n functionName: \"batchMint\",\n args: [params.recipients as `0x${string}`[], params.tokenUris],\n });\n return { txHash };\n }\n}\n\nfunction maybeCoords(chain: EvmChain): EvmCoordinates | undefined {\n try {\n return getCoordinates(chain);\n } catch {\n return undefined;\n }\n}\n"]}
|