@medialane/sdk 0.75.0 → 0.77.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/dist/evm/index.cjs +2 -1
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +1 -1
- package/dist/evm/index.d.ts +1 -1
- package/dist/evm/index.js +2 -1
- package/dist/evm/index.js.map +1 -1
- package/dist/index.cjs +28 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/{services-B7h1qh97.d.ts → services-C5lxQjem.d.ts} +52 -2
- package/dist/{services-CDpAVNqQ.d.cts → services-DgIaaJbX.d.cts} +52 -2
- package/dist/solana/index.cjs +2 -1
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +1 -1
- package/dist/solana/index.d.ts +1 -1
- package/dist/solana/index.js +2 -1
- package/dist/solana/index.js.map +1 -1
- package/dist/starknet/index.cjs +79 -3
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +59 -4
- package/dist/starknet/index.d.ts +59 -4
- package/dist/starknet/index.js +74 -4
- package/dist/starknet/index.js.map +1 -1
- package/dist/stellar/index.cjs +2 -1
- package/dist/stellar/index.cjs.map +1 -1
- package/dist/stellar/index.d.cts +1 -1
- package/dist/stellar/index.d.ts +1 -1
- package/dist/stellar/index.js +2 -1
- package/dist/stellar/index.js.map +1 -1
- package/dist/{types-Cdwb6lXp.d.cts → types-sIc3OCpo.d.cts} +1 -0
- package/dist/{types-Cdwb6lXp.d.ts → types-sIc3OCpo.d.ts} +1 -0
- package/package.json +1 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -4,6 +4,8 @@ var zod = require('zod');
|
|
|
4
4
|
var sha3_js = require('@noble/hashes/sha3.js');
|
|
5
5
|
var base = require('@scure/base');
|
|
6
6
|
var starknet = require('starknet');
|
|
7
|
+
var hkdf_js = require('@noble/hashes/hkdf.js');
|
|
8
|
+
var sha2_js = require('@noble/hashes/sha2.js');
|
|
7
9
|
|
|
8
10
|
// src/config.ts
|
|
9
11
|
|
|
@@ -52,7 +54,8 @@ var COORDINATES = {
|
|
|
52
54
|
// zero offers/licenses ever issued (clean cutover, no reclassification).
|
|
53
55
|
ipSponsorship: "0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c",
|
|
54
56
|
ipSponsorshipClassHash: "0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3",
|
|
55
|
-
ipSponsorshipStartBlock: 11896456
|
|
57
|
+
ipSponsorshipStartBlock: 11896456,
|
|
58
|
+
mediaWalletClassHash: "0x014b210c7d47392691144bafecdca3c6c7791cc295ea305988da0a724c05ac31"
|
|
56
59
|
}
|
|
57
60
|
};
|
|
58
61
|
function getCoordinates(chain) {
|
|
@@ -153,10 +156,10 @@ function normalizeEvm(address) {
|
|
|
153
156
|
const m = /^0x([0-9a-fA-F]{40})$/.exec(address);
|
|
154
157
|
if (!m) throw new Error(`Invalid ETHEREUM/BASE address: "${address}"`);
|
|
155
158
|
const lower = m[1].toLowerCase();
|
|
156
|
-
const
|
|
159
|
+
const hash7 = sha3_js.keccak_256(new TextEncoder().encode(lower));
|
|
157
160
|
let out = "0x";
|
|
158
161
|
for (let i = 0; i < 40; i++) {
|
|
159
|
-
const nibble =
|
|
162
|
+
const nibble = hash7[i >> 1] >> (i % 2 === 0 ? 4 : 0) & 15;
|
|
160
163
|
out += nibble >= 8 ? lower[i].toUpperCase() : lower[i];
|
|
161
164
|
}
|
|
162
165
|
return out;
|
|
@@ -540,6 +543,13 @@ var ApiClient = class {
|
|
|
540
543
|
body: JSON.stringify(params)
|
|
541
544
|
});
|
|
542
545
|
}
|
|
546
|
+
// ─── Business Provisioning ──────────────────────────────────────────────────
|
|
547
|
+
registerBusinessProvisioning(params) {
|
|
548
|
+
return this.post("/v1/business/provisioning", params);
|
|
549
|
+
}
|
|
550
|
+
completeBusinessProvisioning(id) {
|
|
551
|
+
return this.post(`/v1/business/provisioning/${id}/complete`, {});
|
|
552
|
+
}
|
|
543
553
|
// ─── Collection Profiles ────────────────────────────────────────────────────
|
|
544
554
|
getCollectionProfile(contractAddress) {
|
|
545
555
|
return this.request(
|
|
@@ -557,6 +567,12 @@ var ApiClient = class {
|
|
|
557
567
|
{ method: "PATCH", body: JSON.stringify(data), headers: this.bearer(clerkToken) }
|
|
558
568
|
);
|
|
559
569
|
}
|
|
570
|
+
getWalletActivity(address, siwsToken, chain = "STARKNET") {
|
|
571
|
+
return this.request(
|
|
572
|
+
`/v1/wallet-activity?address=${this.addr(address)}&chain=${chain}`,
|
|
573
|
+
{ method: "GET", headers: this.bearer(siwsToken) }
|
|
574
|
+
);
|
|
575
|
+
}
|
|
560
576
|
getGatedContent(contractAddress, clerkToken) {
|
|
561
577
|
return this.request(
|
|
562
578
|
`/v1/collections/${this.addr(contractAddress)}/gated-content`,
|
|
@@ -795,6 +811,18 @@ var ApiClient = class {
|
|
|
795
811
|
getCoin(contract) {
|
|
796
812
|
return this.get(`/v1/coins/${this.addr(contract)}`);
|
|
797
813
|
}
|
|
814
|
+
/**
|
|
815
|
+
* Creator-authed coin profile edit (image/description). Backend authorizes
|
|
816
|
+
* via `coin.creator` (trustless — from the factory event), not a body param;
|
|
817
|
+
* `siwsToken` is the caller's SIWS/Clerk bearer token for `identityAuth`.
|
|
818
|
+
*/
|
|
819
|
+
updateCoinProfile(contract, data, siwsToken) {
|
|
820
|
+
return this.request(`/v1/coins/${this.addr(contract)}`, {
|
|
821
|
+
method: "PATCH",
|
|
822
|
+
body: JSON.stringify(data),
|
|
823
|
+
headers: this.bearer(siwsToken)
|
|
824
|
+
});
|
|
825
|
+
}
|
|
798
826
|
// ─── Collection Drop ────────────────────────────────────────────────────────
|
|
799
827
|
getDropCollections(opts = {}) {
|
|
800
828
|
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "COLLECTION_DROP");
|
|
@@ -863,6 +891,7 @@ SN.ipClubFactory;
|
|
|
863
891
|
SN.ipClubCollectionClassHash;
|
|
864
892
|
SN.ipSponsorship;
|
|
865
893
|
SN.ipSponsorshipClassHash;
|
|
894
|
+
var STARKNET_MEDIAWALLET_CLASS_HASH = SN.mediaWalletClassHash;
|
|
866
895
|
SN.creatorCoinFactory;
|
|
867
896
|
SN.creatorCoinEkuboLauncher;
|
|
868
897
|
SN.creatorCoinClassHash;
|
|
@@ -11689,6 +11718,47 @@ function encodeByteArray(str) {
|
|
|
11689
11718
|
remaining.length.toString()
|
|
11690
11719
|
];
|
|
11691
11720
|
}
|
|
11721
|
+
var STARK_ORDER = 3618502788666131213697322783095070105526743751716087489154079457884512865583n;
|
|
11722
|
+
function deriveOwnerKeyPair(secret, recipientId) {
|
|
11723
|
+
const prk = hkdf_js.extract(sha2_js.sha256, secret);
|
|
11724
|
+
const okm = hkdf_js.expand(sha2_js.sha256, prk, new TextEncoder().encode(recipientId), 32);
|
|
11725
|
+
let scalar = BigInt("0x" + Buffer.from(okm).toString("hex")) % STARK_ORDER;
|
|
11726
|
+
if (scalar === 0n) scalar = 1n;
|
|
11727
|
+
const privateKey = starknet.num.toHex(scalar);
|
|
11728
|
+
const publicKey = starknet.ec.starkCurve.getStarkKey(privateKey);
|
|
11729
|
+
return { privateKey, publicKey };
|
|
11730
|
+
}
|
|
11731
|
+
function ownerConstructorCalldata(ownerPubkey) {
|
|
11732
|
+
return ["0x0", starknet.num.toHex(ownerPubkey), "0x1"];
|
|
11733
|
+
}
|
|
11734
|
+
function computeAccountAddress(ownerPubkey, salt = 0) {
|
|
11735
|
+
return starknet.hash.calculateContractAddressFromHash(
|
|
11736
|
+
starknet.num.toHex(salt),
|
|
11737
|
+
STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
11738
|
+
ownerConstructorCalldata(ownerPubkey),
|
|
11739
|
+
0
|
|
11740
|
+
);
|
|
11741
|
+
}
|
|
11742
|
+
var STARKNET_SIGNER_TYPE = "0x537461726b6e6574205369676e6572";
|
|
11743
|
+
function computeOwnerGuid(ownerPubkey) {
|
|
11744
|
+
return starknet.hash.computePoseidonHash(STARKNET_SIGNER_TYPE, starknet.num.toHex(ownerPubkey));
|
|
11745
|
+
}
|
|
11746
|
+
function buildChangeOwnersCall(accountAddress, removeOwnerPubkey, addOwnerPubkey) {
|
|
11747
|
+
const guidToRemove = computeOwnerGuid(removeOwnerPubkey);
|
|
11748
|
+
return {
|
|
11749
|
+
contractAddress: accountAddress,
|
|
11750
|
+
entrypoint: "change_owners",
|
|
11751
|
+
calldata: ["0x1", guidToRemove, "0x1", "0x0", starknet.num.toHex(addOwnerPubkey)]
|
|
11752
|
+
};
|
|
11753
|
+
}
|
|
11754
|
+
function buildDeployAccountParams(ownerPubkey, salt = 0) {
|
|
11755
|
+
return {
|
|
11756
|
+
classHash: STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
11757
|
+
constructorCalldata: ownerConstructorCalldata(ownerPubkey),
|
|
11758
|
+
addressSalt: starknet.num.toHex(salt),
|
|
11759
|
+
contractAddress: computeAccountAddress(ownerPubkey, salt)
|
|
11760
|
+
};
|
|
11761
|
+
}
|
|
11692
11762
|
|
|
11693
11763
|
exports.ADMIN_HEADERS = ADMIN_HEADERS;
|
|
11694
11764
|
exports.ADMIN_SCOPE = ADMIN_SCOPE;
|
|
@@ -11728,13 +11798,18 @@ exports.build1155CancellationTypedData = build1155CancellationTypedData;
|
|
|
11728
11798
|
exports.build1155OrderTypedData = build1155OrderTypedData;
|
|
11729
11799
|
exports.buildAdminSessionTypedData = buildAdminSessionTypedData;
|
|
11730
11800
|
exports.buildCancellationTypedData = buildCancellationTypedData;
|
|
11801
|
+
exports.buildChangeOwnersCall = buildChangeOwnersCall;
|
|
11731
11802
|
exports.buildCreateCreatorCoinCall = buildCreateCreatorCoinCall;
|
|
11803
|
+
exports.buildDeployAccountParams = buildDeployAccountParams;
|
|
11732
11804
|
exports.buildFeeCall = buildFeeCall;
|
|
11733
11805
|
exports.buildLaunchOnEkuboCalls = buildLaunchOnEkuboCalls;
|
|
11734
11806
|
exports.buildOrderTypedData = buildOrderTypedData;
|
|
11735
11807
|
exports.buybackQuoteRaw = buybackQuoteRaw;
|
|
11736
11808
|
exports.coinToRaw = toRaw;
|
|
11809
|
+
exports.computeAccountAddress = computeAccountAddress;
|
|
11810
|
+
exports.computeOwnerGuid = computeOwnerGuid;
|
|
11737
11811
|
exports.createAdminSessionGrant = createAdminSessionGrant;
|
|
11812
|
+
exports.deriveOwnerKeyPair = deriveOwnerKeyPair;
|
|
11738
11813
|
exports.encodeAdminHeaders = encodeAdminHeaders;
|
|
11739
11814
|
exports.encodeByteArray = encodeByteArray;
|
|
11740
11815
|
exports.fdvHuman = fdvHuman;
|
|
@@ -11747,6 +11822,7 @@ exports.getSiwsStorageKey = getSiwsStorageKey;
|
|
|
11747
11822
|
exports.getStoredSiwsToken = getStoredSiwsToken;
|
|
11748
11823
|
exports.isSiwsTokenValid = isSiwsTokenValid;
|
|
11749
11824
|
exports.normalizeSiwsSignature = normalizeSiwsSignature;
|
|
11825
|
+
exports.ownerConstructorCalldata = ownerConstructorCalldata;
|
|
11750
11826
|
exports.parseAdminHeaders = parseAdminHeaders;
|
|
11751
11827
|
exports.parseCreatorCoinCreated = parseCreatorCoinCreated;
|
|
11752
11828
|
exports.priceToEkuboParams = priceToEkuboParams;
|