@medialane/sdk 0.52.0 → 0.53.0
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/README.md +13 -27
- package/dist/index.cjs +6948 -5930
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9667 -30
- package/dist/index.d.ts +9667 -30
- package/dist/index.js +6949 -5931
- package/dist/index.js.map +1 -1
- package/package.json +4 -44
- package/dist/chains-DE8AJMIY.d.cts +0 -96
- package/dist/chains-DE8AJMIY.d.ts +0 -96
- package/dist/evm/index.cjs +0 -357
- package/dist/evm/index.cjs.map +0 -1
- package/dist/evm/index.d.cts +0 -614
- package/dist/evm/index.d.ts +0 -614
- package/dist/evm/index.js +0 -346
- package/dist/evm/index.js.map +0 -1
- package/dist/index-DkyG8aRV.d.cts +0 -8840
- package/dist/index-aEIEolh3.d.ts +0 -8840
- package/dist/solana/index.cjs +0 -253
- package/dist/solana/index.cjs.map +0 -1
- package/dist/solana/index.d.cts +0 -63
- package/dist/solana/index.d.ts +0 -63
- package/dist/solana/index.js +0 -241
- package/dist/solana/index.js.map +0 -1
- package/dist/starknet/index.cjs +0 -11203
- package/dist/starknet/index.cjs.map +0 -1
- package/dist/starknet/index.d.cts +0 -4
- package/dist/starknet/index.d.ts +0 -4
- package/dist/starknet/index.js +0 -11136
- package/dist/starknet/index.js.map +0 -1
- package/dist/stellar/index.cjs +0 -165
- package/dist/stellar/index.cjs.map +0 -1
- package/dist/stellar/index.d.cts +0 -50
- package/dist/stellar/index.d.ts +0 -50
- package/dist/stellar/index.js +0 -162
- package/dist/stellar/index.js.map +0 -1
- package/dist/types-CYu4fwq8.d.cts +0 -78
- package/dist/types-DdwylC5C.d.ts +0 -78
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medialane/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "Framework-agnostic TypeScript SDK for Medialane.io — the IP marketplace on Starknet",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -11,26 +11,6 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.js",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
|
-
},
|
|
15
|
-
"./starknet": {
|
|
16
|
-
"types": "./dist/starknet/index.d.ts",
|
|
17
|
-
"import": "./dist/starknet/index.js",
|
|
18
|
-
"require": "./dist/starknet/index.cjs"
|
|
19
|
-
},
|
|
20
|
-
"./evm": {
|
|
21
|
-
"types": "./dist/evm/index.d.ts",
|
|
22
|
-
"import": "./dist/evm/index.js",
|
|
23
|
-
"require": "./dist/evm/index.cjs"
|
|
24
|
-
},
|
|
25
|
-
"./solana": {
|
|
26
|
-
"types": "./dist/solana/index.d.ts",
|
|
27
|
-
"import": "./dist/solana/index.js",
|
|
28
|
-
"require": "./dist/solana/index.cjs"
|
|
29
|
-
},
|
|
30
|
-
"./stellar": {
|
|
31
|
-
"types": "./dist/stellar/index.d.ts",
|
|
32
|
-
"import": "./dist/stellar/index.js",
|
|
33
|
-
"require": "./dist/stellar/index.cjs"
|
|
34
14
|
}
|
|
35
15
|
},
|
|
36
16
|
"license": "MIT",
|
|
@@ -47,36 +27,16 @@
|
|
|
47
27
|
"test": "bun test"
|
|
48
28
|
},
|
|
49
29
|
"peerDependencies": {
|
|
50
|
-
"starknet": ">=6.0.0"
|
|
51
|
-
"viem": ">=2.0.0",
|
|
52
|
-
"@solana/web3.js": ">=1.90.0",
|
|
53
|
-
"@stellar/stellar-sdk": ">=13.0.0"
|
|
30
|
+
"starknet": ">=6.0.0"
|
|
54
31
|
},
|
|
55
32
|
"devDependencies": {
|
|
56
|
-
"@solana/web3.js": "^1.98.4",
|
|
57
|
-
"@stellar/stellar-sdk": "^16.0.1",
|
|
58
33
|
"starknet": "^6.11.0",
|
|
59
34
|
"tsup": "^8.0.0",
|
|
60
|
-
"typescript": "^5.6.0"
|
|
61
|
-
"viem": "^2.54.6"
|
|
35
|
+
"typescript": "^5.6.0"
|
|
62
36
|
},
|
|
63
37
|
"dependencies": {
|
|
64
38
|
"@noble/hashes": "^2.2.0",
|
|
65
39
|
"@scure/base": "^2.2.0",
|
|
66
40
|
"zod": "^3.23.8"
|
|
67
|
-
},
|
|
68
|
-
"peerDependenciesMeta": {
|
|
69
|
-
"starknet": {
|
|
70
|
-
"optional": true
|
|
71
|
-
},
|
|
72
|
-
"viem": {
|
|
73
|
-
"optional": true
|
|
74
|
-
},
|
|
75
|
-
"@solana/web3.js": {
|
|
76
|
-
"optional": true
|
|
77
|
-
},
|
|
78
|
-
"@stellar/stellar-sdk": {
|
|
79
|
-
"optional": true
|
|
80
|
-
}
|
|
81
41
|
}
|
|
82
|
-
}
|
|
42
|
+
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/** Mirrors the backend Prisma `Chain` enum. */
|
|
2
|
-
declare const CHAINS: readonly ["STARKNET", "ETHEREUM", "SOLANA", "BASE", "STELLAR", "BITCOIN"];
|
|
3
|
-
type Chain = (typeof CHAINS)[number];
|
|
4
|
-
/** Starknet coordinates of Medialane services + venues. All fields optional
|
|
5
|
-
* because not every service exists on every chain. */
|
|
6
|
-
interface StarknetCoordinates {
|
|
7
|
-
rpcUrl: string;
|
|
8
|
-
marketplace721?: `0x${string}`;
|
|
9
|
-
marketplace721ClassHash?: `0x${string}`;
|
|
10
|
-
marketplace721StartBlock?: number;
|
|
11
|
-
marketplace1155?: `0x${string}`;
|
|
12
|
-
marketplace1155ClassHash?: `0x${string}`;
|
|
13
|
-
marketplace1155StartBlock?: number;
|
|
14
|
-
collection721?: `0x${string}`;
|
|
15
|
-
collection721StartBlock?: number;
|
|
16
|
-
ipNftClassHash?: `0x${string}`;
|
|
17
|
-
ipCollectionClassHash?: `0x${string}`;
|
|
18
|
-
collection1155?: `0x${string}`;
|
|
19
|
-
collection1155FactoryClassHash?: `0x${string}`;
|
|
20
|
-
collection1155ClassHash?: `0x${string}`;
|
|
21
|
-
collection1155StartBlock?: number;
|
|
22
|
-
popFactory?: `0x${string}`;
|
|
23
|
-
popCollectionClassHash?: `0x${string}`;
|
|
24
|
-
dropFactory?: `0x${string}`;
|
|
25
|
-
dropCollectionClassHash?: `0x${string}`;
|
|
26
|
-
nftComments?: `0x${string}`;
|
|
27
|
-
creatorCoinFactory?: `0x${string}`;
|
|
28
|
-
creatorCoinEkuboLauncher?: `0x${string}`;
|
|
29
|
-
creatorCoinClassHash?: `0x${string}`;
|
|
30
|
-
creatorCoinFactoryClassHash?: `0x${string}`;
|
|
31
|
-
creatorCoinStartBlock?: number;
|
|
32
|
-
ekuboCore?: `0x${string}`;
|
|
33
|
-
ipTicketsFactory?: `0x${string}`;
|
|
34
|
-
ipTicketCollectionClassHash?: `0x${string}`;
|
|
35
|
-
ipTicketsStartBlock?: number;
|
|
36
|
-
ipClubRegistry?: `0x${string}`;
|
|
37
|
-
ipClubNftClassHash?: `0x${string}`;
|
|
38
|
-
ipClubStartBlock?: number;
|
|
39
|
-
ipSponsorship?: `0x${string}`;
|
|
40
|
-
ipSponsorshipStartBlock?: number;
|
|
41
|
-
ipSponsorshipLicense?: `0x${string}`;
|
|
42
|
-
}
|
|
43
|
-
/** Coordinates per chain. Only STARKNET is populated today; adding a chain
|
|
44
|
-
* means adding an entry here (litmus test, spec §7). */
|
|
45
|
-
/** EVM coordinates — one shape for Ethereum and Base (same bytecode, two
|
|
46
|
-
* chains). Populated at deploy time (federation Phase 4). */
|
|
47
|
-
interface EvmCoordinates {
|
|
48
|
-
rpcUrl: string;
|
|
49
|
-
marketplace721?: `0x${string}`;
|
|
50
|
-
marketplace721StartBlock?: number;
|
|
51
|
-
marketplace1155?: `0x${string}`;
|
|
52
|
-
marketplace1155StartBlock?: number;
|
|
53
|
-
mipRegistry?: `0x${string}`;
|
|
54
|
-
mipRegistryStartBlock?: number;
|
|
55
|
-
mipEditionsRegistry?: `0x${string}`;
|
|
56
|
-
mipEditionsRegistryStartBlock?: number;
|
|
57
|
-
}
|
|
58
|
-
/** Solana coordinates — base58 program ids. Populated at deploy time. */
|
|
59
|
-
interface SolanaCoordinates {
|
|
60
|
-
rpcUrl: string;
|
|
61
|
-
mipCollectionsProgram?: string;
|
|
62
|
-
marketplaceProgram?: string;
|
|
63
|
-
startSlot?: number;
|
|
64
|
-
}
|
|
65
|
-
/** Stellar (Soroban) coordinates — strkey contract ids. Populated at deploy
|
|
66
|
-
* time; the registry takes the collection WASM hash as a constructor arg. */
|
|
67
|
-
interface StellarCoordinates {
|
|
68
|
-
rpcUrl: string;
|
|
69
|
-
mipRegistry?: string;
|
|
70
|
-
marketplace?: string;
|
|
71
|
-
collectionWasmHash?: string;
|
|
72
|
-
startLedger?: number;
|
|
73
|
-
}
|
|
74
|
-
/** Per-chain coordinate shapes. Every chain is an equal entry — no chain is
|
|
75
|
-
* privileged in core (chain-sovereignty I2/I4). */
|
|
76
|
-
interface CoordinatesByChain {
|
|
77
|
-
STARKNET?: StarknetCoordinates;
|
|
78
|
-
ETHEREUM?: EvmCoordinates;
|
|
79
|
-
BASE?: EvmCoordinates;
|
|
80
|
-
SOLANA?: SolanaCoordinates;
|
|
81
|
-
STELLAR?: StellarCoordinates;
|
|
82
|
-
BITCOIN?: never;
|
|
83
|
-
}
|
|
84
|
-
/** @deprecated Renamed — use `StarknetCoordinates` (coordinates are per-chain-shaped). */
|
|
85
|
-
type ChainCoordinates = StarknetCoordinates;
|
|
86
|
-
declare function getCoordinates(chain: "STARKNET"): StarknetCoordinates;
|
|
87
|
-
declare function getCoordinates(chain: "ETHEREUM" | "BASE"): EvmCoordinates;
|
|
88
|
-
declare function getCoordinates(chain: "SOLANA"): SolanaCoordinates;
|
|
89
|
-
declare function getCoordinates(chain: "STELLAR"): StellarCoordinates;
|
|
90
|
-
declare function getCoordinates(chain: Chain): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates;
|
|
91
|
-
declare const DEFAULT_CHAIN: Chain;
|
|
92
|
-
/** Typed Starknet coordinates for Starknet-only modules; throws when the
|
|
93
|
-
* client is scoped to another chain. */
|
|
94
|
-
declare function getStarknetCoordinates(chain: Chain): StarknetCoordinates;
|
|
95
|
-
|
|
96
|
-
export { type Chain as C, DEFAULT_CHAIN as D, type EvmCoordinates as E, type SolanaCoordinates as S, CHAINS as a, type ChainCoordinates as b, type CoordinatesByChain as c, type StarknetCoordinates as d, type StellarCoordinates as e, getStarknetCoordinates as f, getCoordinates as g };
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/** Mirrors the backend Prisma `Chain` enum. */
|
|
2
|
-
declare const CHAINS: readonly ["STARKNET", "ETHEREUM", "SOLANA", "BASE", "STELLAR", "BITCOIN"];
|
|
3
|
-
type Chain = (typeof CHAINS)[number];
|
|
4
|
-
/** Starknet coordinates of Medialane services + venues. All fields optional
|
|
5
|
-
* because not every service exists on every chain. */
|
|
6
|
-
interface StarknetCoordinates {
|
|
7
|
-
rpcUrl: string;
|
|
8
|
-
marketplace721?: `0x${string}`;
|
|
9
|
-
marketplace721ClassHash?: `0x${string}`;
|
|
10
|
-
marketplace721StartBlock?: number;
|
|
11
|
-
marketplace1155?: `0x${string}`;
|
|
12
|
-
marketplace1155ClassHash?: `0x${string}`;
|
|
13
|
-
marketplace1155StartBlock?: number;
|
|
14
|
-
collection721?: `0x${string}`;
|
|
15
|
-
collection721StartBlock?: number;
|
|
16
|
-
ipNftClassHash?: `0x${string}`;
|
|
17
|
-
ipCollectionClassHash?: `0x${string}`;
|
|
18
|
-
collection1155?: `0x${string}`;
|
|
19
|
-
collection1155FactoryClassHash?: `0x${string}`;
|
|
20
|
-
collection1155ClassHash?: `0x${string}`;
|
|
21
|
-
collection1155StartBlock?: number;
|
|
22
|
-
popFactory?: `0x${string}`;
|
|
23
|
-
popCollectionClassHash?: `0x${string}`;
|
|
24
|
-
dropFactory?: `0x${string}`;
|
|
25
|
-
dropCollectionClassHash?: `0x${string}`;
|
|
26
|
-
nftComments?: `0x${string}`;
|
|
27
|
-
creatorCoinFactory?: `0x${string}`;
|
|
28
|
-
creatorCoinEkuboLauncher?: `0x${string}`;
|
|
29
|
-
creatorCoinClassHash?: `0x${string}`;
|
|
30
|
-
creatorCoinFactoryClassHash?: `0x${string}`;
|
|
31
|
-
creatorCoinStartBlock?: number;
|
|
32
|
-
ekuboCore?: `0x${string}`;
|
|
33
|
-
ipTicketsFactory?: `0x${string}`;
|
|
34
|
-
ipTicketCollectionClassHash?: `0x${string}`;
|
|
35
|
-
ipTicketsStartBlock?: number;
|
|
36
|
-
ipClubRegistry?: `0x${string}`;
|
|
37
|
-
ipClubNftClassHash?: `0x${string}`;
|
|
38
|
-
ipClubStartBlock?: number;
|
|
39
|
-
ipSponsorship?: `0x${string}`;
|
|
40
|
-
ipSponsorshipStartBlock?: number;
|
|
41
|
-
ipSponsorshipLicense?: `0x${string}`;
|
|
42
|
-
}
|
|
43
|
-
/** Coordinates per chain. Only STARKNET is populated today; adding a chain
|
|
44
|
-
* means adding an entry here (litmus test, spec §7). */
|
|
45
|
-
/** EVM coordinates — one shape for Ethereum and Base (same bytecode, two
|
|
46
|
-
* chains). Populated at deploy time (federation Phase 4). */
|
|
47
|
-
interface EvmCoordinates {
|
|
48
|
-
rpcUrl: string;
|
|
49
|
-
marketplace721?: `0x${string}`;
|
|
50
|
-
marketplace721StartBlock?: number;
|
|
51
|
-
marketplace1155?: `0x${string}`;
|
|
52
|
-
marketplace1155StartBlock?: number;
|
|
53
|
-
mipRegistry?: `0x${string}`;
|
|
54
|
-
mipRegistryStartBlock?: number;
|
|
55
|
-
mipEditionsRegistry?: `0x${string}`;
|
|
56
|
-
mipEditionsRegistryStartBlock?: number;
|
|
57
|
-
}
|
|
58
|
-
/** Solana coordinates — base58 program ids. Populated at deploy time. */
|
|
59
|
-
interface SolanaCoordinates {
|
|
60
|
-
rpcUrl: string;
|
|
61
|
-
mipCollectionsProgram?: string;
|
|
62
|
-
marketplaceProgram?: string;
|
|
63
|
-
startSlot?: number;
|
|
64
|
-
}
|
|
65
|
-
/** Stellar (Soroban) coordinates — strkey contract ids. Populated at deploy
|
|
66
|
-
* time; the registry takes the collection WASM hash as a constructor arg. */
|
|
67
|
-
interface StellarCoordinates {
|
|
68
|
-
rpcUrl: string;
|
|
69
|
-
mipRegistry?: string;
|
|
70
|
-
marketplace?: string;
|
|
71
|
-
collectionWasmHash?: string;
|
|
72
|
-
startLedger?: number;
|
|
73
|
-
}
|
|
74
|
-
/** Per-chain coordinate shapes. Every chain is an equal entry — no chain is
|
|
75
|
-
* privileged in core (chain-sovereignty I2/I4). */
|
|
76
|
-
interface CoordinatesByChain {
|
|
77
|
-
STARKNET?: StarknetCoordinates;
|
|
78
|
-
ETHEREUM?: EvmCoordinates;
|
|
79
|
-
BASE?: EvmCoordinates;
|
|
80
|
-
SOLANA?: SolanaCoordinates;
|
|
81
|
-
STELLAR?: StellarCoordinates;
|
|
82
|
-
BITCOIN?: never;
|
|
83
|
-
}
|
|
84
|
-
/** @deprecated Renamed — use `StarknetCoordinates` (coordinates are per-chain-shaped). */
|
|
85
|
-
type ChainCoordinates = StarknetCoordinates;
|
|
86
|
-
declare function getCoordinates(chain: "STARKNET"): StarknetCoordinates;
|
|
87
|
-
declare function getCoordinates(chain: "ETHEREUM" | "BASE"): EvmCoordinates;
|
|
88
|
-
declare function getCoordinates(chain: "SOLANA"): SolanaCoordinates;
|
|
89
|
-
declare function getCoordinates(chain: "STELLAR"): StellarCoordinates;
|
|
90
|
-
declare function getCoordinates(chain: Chain): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates;
|
|
91
|
-
declare const DEFAULT_CHAIN: Chain;
|
|
92
|
-
/** Typed Starknet coordinates for Starknet-only modules; throws when the
|
|
93
|
-
* client is scoped to another chain. */
|
|
94
|
-
declare function getStarknetCoordinates(chain: Chain): StarknetCoordinates;
|
|
95
|
-
|
|
96
|
-
export { type Chain as C, DEFAULT_CHAIN as D, type EvmCoordinates as E, type SolanaCoordinates as S, CHAINS as a, type ChainCoordinates as b, type CoordinatesByChain as c, type StarknetCoordinates as d, type StellarCoordinates as e, getStarknetCoordinates as f, getCoordinates as g };
|
package/dist/evm/index.cjs
DELETED
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var viem = require('viem');
|
|
4
|
-
|
|
5
|
-
// src/evm/typedData.ts
|
|
6
|
-
var EVM_ORDER_TYPES = {
|
|
7
|
-
OfferItem: [
|
|
8
|
-
{ name: "itemType", type: "uint8" },
|
|
9
|
-
{ name: "token", type: "address" },
|
|
10
|
-
{ name: "identifier", type: "uint256" },
|
|
11
|
-
{ name: "amount", type: "uint256" }
|
|
12
|
-
],
|
|
13
|
-
ConsiderationItem: [
|
|
14
|
-
{ name: "itemType", type: "uint8" },
|
|
15
|
-
{ name: "token", type: "address" },
|
|
16
|
-
{ name: "identifier", type: "uint256" },
|
|
17
|
-
{ name: "amount", type: "uint256" },
|
|
18
|
-
{ name: "recipient", type: "address" }
|
|
19
|
-
],
|
|
20
|
-
OrderParameters: [
|
|
21
|
-
{ name: "offerer", type: "address" },
|
|
22
|
-
{ name: "offer", type: "OfferItem" },
|
|
23
|
-
{ name: "consideration", type: "ConsiderationItem" },
|
|
24
|
-
{ name: "royaltyMaxBps", type: "uint256" },
|
|
25
|
-
{ name: "startTime", type: "uint256" },
|
|
26
|
-
{ name: "endTime", type: "uint256" },
|
|
27
|
-
{ name: "salt", type: "uint256" },
|
|
28
|
-
{ name: "counter", type: "uint256" }
|
|
29
|
-
]
|
|
30
|
-
};
|
|
31
|
-
function evmOrderDomain(chainId, verifyingContract) {
|
|
32
|
-
return { name: "Medialane", version: "1", chainId, verifyingContract };
|
|
33
|
-
}
|
|
34
|
-
function evmOrderDigest(chainId, verifyingContract, parameters) {
|
|
35
|
-
return viem.hashTypedData({
|
|
36
|
-
domain: evmOrderDomain(chainId, verifyingContract),
|
|
37
|
-
types: EVM_ORDER_TYPES,
|
|
38
|
-
primaryType: "OrderParameters",
|
|
39
|
-
message: parameters
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// src/chains.ts
|
|
44
|
-
var COORDINATES = {
|
|
45
|
-
STARKNET: {
|
|
46
|
-
rpcUrl: "https://rpc.starknet.lava.build",
|
|
47
|
-
marketplace721: "0x03eda9a2b6ad90845a43591bac8083ebaf677d51fdf20f503b2c01889e3131fc",
|
|
48
|
-
marketplace721ClassHash: "0x0700d9230d07e5203e27778c0dc70f9134d2b25bf319f7cf8348dc66a6923e90",
|
|
49
|
-
marketplace721StartBlock: 11198146,
|
|
50
|
-
marketplace1155: "0x07c4ce1c19ea48cc11135ed22b19ff745f5aec508c3828593002e4f76fdb1b38",
|
|
51
|
-
marketplace1155ClassHash: "0x0242f5c388da7cee2d99e2a69453c8159bf927fbec4e797a3cfdcbbcb5b68328",
|
|
52
|
-
marketplace1155StartBlock: 11198267,
|
|
53
|
-
collection721: "0x0225c3ae09506b8d97adc39649ca740dad5aac195b7f5f0441cc1852947acaea",
|
|
54
|
-
collection721StartBlock: 11198496,
|
|
55
|
-
ipNftClassHash: "0x012d3ae40ba35c7e2be0946532dac60e48932447912fdf96b674da67c029b9cc",
|
|
56
|
-
ipCollectionClassHash: "0x022155a1a130a40e57aac4b89c07fab3f616bc351b1270fc40f756b963afe8b4",
|
|
57
|
-
collection1155: "0x015368976d46fae5bfa1c58600f641d5aa5dbbf53ebc6b78aa3922194aad3551",
|
|
58
|
-
collection1155FactoryClassHash: "0x04eb6b419770f13bd191f120b9fc9ee624c0613ad4490062d293ca2016b3b1d2",
|
|
59
|
-
collection1155ClassHash: "0x06cf3f5a2322dac35e07a6064a5b8802f19fda8aa3f4726f0cb7bc05dea1bd78",
|
|
60
|
-
collection1155StartBlock: 11199527,
|
|
61
|
-
popFactory: "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111",
|
|
62
|
-
popCollectionClassHash: "0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f",
|
|
63
|
-
dropFactory: "0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800",
|
|
64
|
-
dropCollectionClassHash: "0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282",
|
|
65
|
-
nftComments: "0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843",
|
|
66
|
-
creatorCoinFactory: "0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c",
|
|
67
|
-
creatorCoinEkuboLauncher: "0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4",
|
|
68
|
-
creatorCoinClassHash: "0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6",
|
|
69
|
-
creatorCoinFactoryClassHash: "0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55",
|
|
70
|
-
creatorCoinStartBlock: 10474544,
|
|
71
|
-
ekuboCore: "0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b",
|
|
72
|
-
ipTicketsFactory: "0x0664c2d6a4da9ee3ff053ceeba7579c01f2fedfd9d2b57b4c07af3734bd4acab",
|
|
73
|
-
ipTicketCollectionClassHash: "0x086f59c416e365e2bee4ceff9f1dcb96198f2342d50ba4621f60b831863adb6",
|
|
74
|
-
ipTicketsStartBlock: 11404656,
|
|
75
|
-
ipClubRegistry: "0x00e189c619b6bb07d78973a149641c59c37eb0716f8584d7520bce12d303eede",
|
|
76
|
-
ipClubNftClassHash: "0x02bc9b20cca21b04245e9215bf7121f4d7295b195890e449b472b573017fb889",
|
|
77
|
-
ipClubStartBlock: 11404776,
|
|
78
|
-
ipSponsorship: "0x044d9b9c3bb29b94685b0a3fe27a5e2dfa30a3637ab55979c718ebcd3268bc2f",
|
|
79
|
-
ipSponsorshipStartBlock: 11405085,
|
|
80
|
-
// Dedicated ip-erc721/MIP instance for sponsorship receipts (class hash
|
|
81
|
-
// 0x01bd7e39c5135b32b664e34cbbb4eafbd707a0fbc3ec2ef28657f52577d277d7) —
|
|
82
|
-
// never the genesis-mint instance.
|
|
83
|
-
ipSponsorshipLicense: "0x06bcfc4e97758a2abf95af4bd49596efdbfd88ccd740caddc56ad0a4bd095839"
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
function getCoordinates(chain) {
|
|
87
|
-
const c = COORDINATES[chain];
|
|
88
|
-
if (!c) throw new Error(`No coordinates configured for chain "${chain}"`);
|
|
89
|
-
return c;
|
|
90
|
-
}
|
|
91
|
-
var EvmVenueABI = viem.parseAbi([
|
|
92
|
-
"struct OfferItem { uint8 itemType; address token; uint256 identifier; uint256 amount; }",
|
|
93
|
-
"struct ConsiderationItem { uint8 itemType; address token; uint256 identifier; uint256 amount; address recipient; }",
|
|
94
|
-
"struct OrderParameters { address offerer; OfferItem offer; ConsiderationItem consideration; uint256 royaltyMaxBps; uint256 startTime; uint256 endTime; uint256 salt; uint256 counter; }",
|
|
95
|
-
"function registerOrder(OrderParameters parameters, bytes signature)",
|
|
96
|
-
"function fulfillOrder(bytes32 orderHash) payable",
|
|
97
|
-
"function cancelOrder(bytes32 orderHash)",
|
|
98
|
-
"function incrementCounter()",
|
|
99
|
-
"function getOrderHash(OrderParameters parameters) view returns (bytes32)",
|
|
100
|
-
"function getCounter(address offerer) view returns (uint256)",
|
|
101
|
-
"function version() pure returns (string)",
|
|
102
|
-
"event OrderCreated(bytes32 indexed orderHash, address indexed offerer)",
|
|
103
|
-
"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)",
|
|
104
|
-
"event OrderCancelled(bytes32 indexed orderHash, address indexed offerer)",
|
|
105
|
-
"event CounterIncremented(address indexed offerer, uint256 newCounter)"
|
|
106
|
-
]);
|
|
107
|
-
var EvmVenue1155ABI = viem.parseAbi([
|
|
108
|
-
"function fulfillOrder(bytes32 orderHash, uint256 quantity) payable",
|
|
109
|
-
"event OrderFulfilled(bytes32 indexed orderHash, address indexed offerer, address indexed fulfiller, uint256 quantity, uint256 remainingAmount, uint256 saleAmount, address royaltyReceiver, uint256 royaltyAmount)"
|
|
110
|
-
]);
|
|
111
|
-
var EvmMipRegistryABI = viem.parseAbi([
|
|
112
|
-
"function createCollection(string name, string symbol, string baseUri, uint96 royaltyBps) returns (uint256 collectionId, address collection)",
|
|
113
|
-
"function getCollection(uint256 collectionId) view returns (address collection, address creator)",
|
|
114
|
-
"function collectionCount() view returns (uint256)",
|
|
115
|
-
"event CollectionCreated(uint256 indexed collectionId, address indexed collection, address indexed creator, string name, string symbol, string baseUri)"
|
|
116
|
-
]);
|
|
117
|
-
var EvmMipCollectionABI = viem.parseAbi([
|
|
118
|
-
"function mint(address to, string metadataUri) returns (uint256 tokenId)",
|
|
119
|
-
"function batchMint(address[] to, string[] metadataUris) returns (uint256[] tokenIds)",
|
|
120
|
-
"function tokenURI(uint256 tokenId) view returns (string)",
|
|
121
|
-
"function ownerOf(uint256 tokenId) view returns (address)",
|
|
122
|
-
"function balanceOf(address owner) view returns (uint256)",
|
|
123
|
-
"function owner() view returns (address)",
|
|
124
|
-
"event TokenMinted(uint256 indexed tokenId, address indexed owner, string metadataUri)",
|
|
125
|
-
"event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"
|
|
126
|
-
]);
|
|
127
|
-
|
|
128
|
-
// src/evm/venue.ts
|
|
129
|
-
var EvmVenue = class {
|
|
130
|
-
constructor(opts) {
|
|
131
|
-
this.chain = opts.chain;
|
|
132
|
-
this.chainId = opts.chainId;
|
|
133
|
-
this.publicClient = opts.publicClient;
|
|
134
|
-
this.variant = opts.variant;
|
|
135
|
-
const coords = maybeCoords(opts.chain);
|
|
136
|
-
const contract = opts.contract ?? (opts.variant === "721" ? coords?.marketplace721 : coords?.marketplace1155);
|
|
137
|
-
if (!contract) throw new Error(`No ${opts.variant} venue configured for ${opts.chain}`);
|
|
138
|
-
this.contract = contract;
|
|
139
|
-
}
|
|
140
|
-
/** Builds the order struct, signs the EIP-712 digest, and registers it.
|
|
141
|
-
* The digest is the canonical order id on EVM chains. */
|
|
142
|
-
async registerOrder(signer, params) {
|
|
143
|
-
const account = signer.account;
|
|
144
|
-
if (!account) throw new Error("WalletClient has no account");
|
|
145
|
-
const counter = await this.getCounter(account.address);
|
|
146
|
-
const nft = {
|
|
147
|
-
itemType: 2,
|
|
148
|
-
token: params.asset.contract,
|
|
149
|
-
identifier: BigInt(params.asset.tokenId),
|
|
150
|
-
amount: 1n
|
|
151
|
-
};
|
|
152
|
-
const payment = {
|
|
153
|
-
itemType: params.paymentToken === NATIVE_SENTINEL ? 0 : 1,
|
|
154
|
-
token: params.paymentToken === NATIVE_SENTINEL ? "0x0000000000000000000000000000000000000000" : params.paymentToken,
|
|
155
|
-
identifier: 0n,
|
|
156
|
-
amount: BigInt(params.amount)
|
|
157
|
-
};
|
|
158
|
-
const order = params.side === "listing" ? {
|
|
159
|
-
offerer: account.address,
|
|
160
|
-
offer: nft,
|
|
161
|
-
consideration: { ...payment, recipient: account.address },
|
|
162
|
-
...commonFields(params)
|
|
163
|
-
} : {
|
|
164
|
-
offerer: account.address,
|
|
165
|
-
offer: payment,
|
|
166
|
-
consideration: { ...nft, recipient: account.address },
|
|
167
|
-
...commonFields(params)
|
|
168
|
-
};
|
|
169
|
-
order.counter = counter;
|
|
170
|
-
const signature = await signer.signTypedData({
|
|
171
|
-
account,
|
|
172
|
-
domain: evmOrderDomain(this.chainId, this.contract),
|
|
173
|
-
types: EVM_ORDER_TYPES,
|
|
174
|
-
primaryType: "OrderParameters",
|
|
175
|
-
message: order
|
|
176
|
-
});
|
|
177
|
-
const txHash = await signer.writeContract({
|
|
178
|
-
account,
|
|
179
|
-
chain: signer.chain,
|
|
180
|
-
address: this.contract,
|
|
181
|
-
abi: EvmVenueABI,
|
|
182
|
-
functionName: "registerOrder",
|
|
183
|
-
args: [order, signature]
|
|
184
|
-
});
|
|
185
|
-
return { txHash, orderRef: evmOrderDigest(this.chainId, this.contract, order) };
|
|
186
|
-
}
|
|
187
|
-
async fulfillOrder(signer, orderRef, opts) {
|
|
188
|
-
const account = signer.account;
|
|
189
|
-
if (!account) throw new Error("WalletClient has no account");
|
|
190
|
-
const value = opts?.value ? BigInt(opts.value) : void 0;
|
|
191
|
-
const txHash = this.variant === "1155" ? await signer.writeContract({
|
|
192
|
-
account,
|
|
193
|
-
chain: signer.chain,
|
|
194
|
-
address: this.contract,
|
|
195
|
-
abi: EvmVenue1155ABI,
|
|
196
|
-
functionName: "fulfillOrder",
|
|
197
|
-
args: [orderRef, BigInt(opts?.quantity ?? "1")],
|
|
198
|
-
value
|
|
199
|
-
}) : await signer.writeContract({
|
|
200
|
-
account,
|
|
201
|
-
chain: signer.chain,
|
|
202
|
-
address: this.contract,
|
|
203
|
-
abi: EvmVenueABI,
|
|
204
|
-
functionName: "fulfillOrder",
|
|
205
|
-
args: [orderRef],
|
|
206
|
-
value
|
|
207
|
-
});
|
|
208
|
-
return { txHash };
|
|
209
|
-
}
|
|
210
|
-
async cancelOrder(signer, orderRef) {
|
|
211
|
-
const account = signer.account;
|
|
212
|
-
if (!account) throw new Error("WalletClient has no account");
|
|
213
|
-
const txHash = await signer.writeContract({
|
|
214
|
-
account,
|
|
215
|
-
chain: signer.chain,
|
|
216
|
-
address: this.contract,
|
|
217
|
-
abi: EvmVenueABI,
|
|
218
|
-
functionName: "cancelOrder",
|
|
219
|
-
args: [orderRef]
|
|
220
|
-
});
|
|
221
|
-
return { txHash };
|
|
222
|
-
}
|
|
223
|
-
async incrementCounter(signer) {
|
|
224
|
-
const account = signer.account;
|
|
225
|
-
if (!account) throw new Error("WalletClient has no account");
|
|
226
|
-
const txHash = await signer.writeContract({
|
|
227
|
-
account,
|
|
228
|
-
chain: signer.chain,
|
|
229
|
-
address: this.contract,
|
|
230
|
-
abi: EvmVenueABI,
|
|
231
|
-
functionName: "incrementCounter",
|
|
232
|
-
args: []
|
|
233
|
-
});
|
|
234
|
-
return { txHash };
|
|
235
|
-
}
|
|
236
|
-
async getOrderDetails(orderRef) {
|
|
237
|
-
return this.publicClient.readContract({
|
|
238
|
-
address: this.contract,
|
|
239
|
-
abi: [
|
|
240
|
-
{
|
|
241
|
-
type: "function",
|
|
242
|
-
name: "getOrderDetails",
|
|
243
|
-
stateMutability: "view",
|
|
244
|
-
inputs: [{ name: "orderHash", type: "bytes32" }],
|
|
245
|
-
outputs: [{ name: "", type: "bytes" }]
|
|
246
|
-
}
|
|
247
|
-
],
|
|
248
|
-
functionName: "getOrderDetails",
|
|
249
|
-
args: [orderRef]
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
async getCounter(address) {
|
|
253
|
-
return this.publicClient.readContract({
|
|
254
|
-
address: this.contract,
|
|
255
|
-
abi: EvmVenueABI,
|
|
256
|
-
functionName: "getCounter",
|
|
257
|
-
args: [address]
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
var NATIVE_SENTINEL = "native";
|
|
262
|
-
function commonFields(params) {
|
|
263
|
-
return {
|
|
264
|
-
royaltyMaxBps: BigInt(params.royaltyMaxBps),
|
|
265
|
-
startTime: BigInt(params.startTime),
|
|
266
|
-
endTime: BigInt(params.endTime),
|
|
267
|
-
salt: BigInt(params.salt),
|
|
268
|
-
counter: 0n
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
function maybeCoords(chain) {
|
|
272
|
-
try {
|
|
273
|
-
return getCoordinates(chain);
|
|
274
|
-
} catch {
|
|
275
|
-
return void 0;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
var EvmIssuance = class {
|
|
279
|
-
constructor(opts) {
|
|
280
|
-
this.chain = opts.chain;
|
|
281
|
-
this.publicClient = opts.publicClient;
|
|
282
|
-
const registry = opts.registry ?? maybeCoords2(opts.chain)?.mipRegistry;
|
|
283
|
-
if (!registry) throw new Error(`No MIP registry configured for ${opts.chain}`);
|
|
284
|
-
this.registry = registry;
|
|
285
|
-
}
|
|
286
|
-
async createCollection(signer, params) {
|
|
287
|
-
const account = signer.account;
|
|
288
|
-
if (!account) throw new Error("WalletClient has no account");
|
|
289
|
-
const txHash = await signer.writeContract({
|
|
290
|
-
account,
|
|
291
|
-
chain: signer.chain,
|
|
292
|
-
address: this.registry,
|
|
293
|
-
abi: EvmMipRegistryABI,
|
|
294
|
-
functionName: "createCollection",
|
|
295
|
-
args: [params.name, params.symbol, params.baseUri, BigInt(params.royaltyBps)]
|
|
296
|
-
});
|
|
297
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
298
|
-
const [created] = viem.parseEventLogs({
|
|
299
|
-
abi: EvmMipRegistryABI,
|
|
300
|
-
eventName: "CollectionCreated",
|
|
301
|
-
logs: receipt.logs
|
|
302
|
-
});
|
|
303
|
-
return { txHash, collection: created?.args.collection ?? "" };
|
|
304
|
-
}
|
|
305
|
-
async mint(signer, params) {
|
|
306
|
-
const account = signer.account;
|
|
307
|
-
if (!account) throw new Error("WalletClient has no account");
|
|
308
|
-
const txHash = await signer.writeContract({
|
|
309
|
-
account,
|
|
310
|
-
chain: signer.chain,
|
|
311
|
-
address: params.collection,
|
|
312
|
-
abi: EvmMipCollectionABI,
|
|
313
|
-
functionName: "mint",
|
|
314
|
-
args: [params.recipient, params.tokenUri]
|
|
315
|
-
});
|
|
316
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
317
|
-
const [minted] = viem.parseEventLogs({
|
|
318
|
-
abi: EvmMipCollectionABI,
|
|
319
|
-
eventName: "TokenMinted",
|
|
320
|
-
logs: receipt.logs
|
|
321
|
-
});
|
|
322
|
-
return { txHash, tokenId: (minted?.args.tokenId ?? 0n).toString() };
|
|
323
|
-
}
|
|
324
|
-
async batchMint(signer, params) {
|
|
325
|
-
const account = signer.account;
|
|
326
|
-
if (!account) throw new Error("WalletClient has no account");
|
|
327
|
-
const txHash = await signer.writeContract({
|
|
328
|
-
account,
|
|
329
|
-
chain: signer.chain,
|
|
330
|
-
address: params.collection,
|
|
331
|
-
abi: EvmMipCollectionABI,
|
|
332
|
-
functionName: "batchMint",
|
|
333
|
-
args: [params.recipients, params.tokenUris]
|
|
334
|
-
});
|
|
335
|
-
return { txHash };
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
function maybeCoords2(chain) {
|
|
339
|
-
try {
|
|
340
|
-
return getCoordinates(chain);
|
|
341
|
-
} catch {
|
|
342
|
-
return void 0;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
exports.EVM_ORDER_TYPES = EVM_ORDER_TYPES;
|
|
347
|
-
exports.EvmIssuance = EvmIssuance;
|
|
348
|
-
exports.EvmMipCollectionABI = EvmMipCollectionABI;
|
|
349
|
-
exports.EvmMipRegistryABI = EvmMipRegistryABI;
|
|
350
|
-
exports.EvmVenue = EvmVenue;
|
|
351
|
-
exports.EvmVenue1155ABI = EvmVenue1155ABI;
|
|
352
|
-
exports.EvmVenueABI = EvmVenueABI;
|
|
353
|
-
exports.NATIVE_SENTINEL = NATIVE_SENTINEL;
|
|
354
|
-
exports.evmOrderDigest = evmOrderDigest;
|
|
355
|
-
exports.evmOrderDomain = evmOrderDomain;
|
|
356
|
-
//# sourceMappingURL=index.cjs.map
|
|
357
|
-
//# sourceMappingURL=index.cjs.map
|