@medialane/ui 0.187.0 → 0.189.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/components/drop/create/drop-create.d.cts +1 -1
- package/dist/components/drop/create/drop-create.d.ts +1 -1
- package/dist/components/drop/create/launch-dialog.cjs +1 -1
- package/dist/components/drop/create/launch-dialog.cjs.map +1 -1
- package/dist/components/drop/create/launch-dialog.d.cts +1 -1
- package/dist/components/drop/create/launch-dialog.d.ts +1 -1
- package/dist/components/drop/create/launch-dialog.js +1 -1
- package/dist/components/drop/create/launch-dialog.js.map +1 -1
- package/dist/components/drop/page/drop-page.cjs +3 -3
- package/dist/components/drop/page/drop-page.cjs.map +1 -1
- package/dist/components/drop/page/drop-page.d.cts +1 -1
- package/dist/components/drop/page/drop-page.d.ts +1 -1
- package/dist/components/drop/page/drop-page.js +3 -3
- package/dist/components/drop/page/drop-page.js.map +1 -1
- package/dist/components/fast-mint/fast-mint.cjs +4 -5
- package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
- package/dist/components/fast-mint/fast-mint.js +4 -5
- package/dist/components/fast-mint/fast-mint.js.map +1 -1
- package/dist/components/fast-mint/types.cjs.map +1 -1
- package/dist/components/fast-mint/types.d.cts +1 -2
- package/dist/components/fast-mint/types.d.ts +1 -2
- package/dist/components/media-wallet/media-wallet-activity.d.cts +0 -1
- package/dist/components/media-wallet/media-wallet-activity.d.ts +0 -1
- package/dist/components/media-wallet/media-wallet-home.cjs +5 -5
- package/dist/components/media-wallet/media-wallet-home.cjs.map +1 -1
- package/dist/components/media-wallet/media-wallet-home.d.cts +0 -1
- package/dist/components/media-wallet/media-wallet-home.d.ts +0 -1
- package/dist/components/media-wallet/media-wallet-home.js +5 -5
- package/dist/components/media-wallet/media-wallet-home.js.map +1 -1
- package/dist/components/media-wallet/media-wallet-overlay.d.cts +0 -1
- package/dist/components/media-wallet/media-wallet-overlay.d.ts +0 -1
- package/dist/components/media-wallet/media-wallet-send.cjs +7 -7
- package/dist/components/media-wallet/media-wallet-send.cjs.map +1 -1
- package/dist/components/media-wallet/media-wallet-send.d.cts +0 -1
- package/dist/components/media-wallet/media-wallet-send.d.ts +0 -1
- package/dist/components/media-wallet/media-wallet-send.js +7 -7
- package/dist/components/media-wallet/media-wallet-send.js.map +1 -1
- package/dist/components/media-wallet/media-wallet-token-detail.cjs +2 -2
- package/dist/components/media-wallet/media-wallet-token-detail.cjs.map +1 -1
- package/dist/components/media-wallet/media-wallet-token-detail.d.cts +0 -1
- package/dist/components/media-wallet/media-wallet-token-detail.d.ts +0 -1
- package/dist/components/media-wallet/media-wallet-token-detail.js +2 -2
- package/dist/components/media-wallet/media-wallet-token-detail.js.map +1 -1
- package/dist/components/media-wallet/media-wallet.d.cts +0 -1
- package/dist/components/media-wallet/media-wallet.d.ts +0 -1
- package/dist/components/media-wallet/types.cjs.map +1 -1
- package/dist/components/media-wallet/types.d.cts +0 -2
- package/dist/components/media-wallet/types.d.ts +0 -2
- package/dist/components/media-wallet/types.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/app-wallet.cjs +4 -3
- package/dist/utils/app-wallet.cjs.map +1 -1
- package/dist/utils/app-wallet.d.cts +2 -2
- package/dist/utils/app-wallet.d.ts +2 -2
- package/dist/utils/app-wallet.js +4 -3
- package/dist/utils/app-wallet.js.map +1 -1
- package/dist/utils/drop/actions.cjs +3 -3
- package/dist/utils/drop/actions.cjs.map +1 -1
- package/dist/utils/drop/actions.d.cts +2 -3
- package/dist/utils/drop/actions.d.ts +2 -3
- package/dist/utils/drop/actions.js +3 -3
- package/dist/utils/drop/actions.js.map +1 -1
- package/dist/utils/drop/types.cjs.map +1 -1
- package/dist/utils/drop/types.d.cts +3 -6
- package/dist/utils/drop/types.d.ts +3 -6
- package/dist/utils/media-wallet/use-erc20-balance.cjs +14 -17
- package/dist/utils/media-wallet/use-erc20-balance.cjs.map +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.d.cts +5 -4
- package/dist/utils/media-wallet/use-erc20-balance.d.ts +5 -4
- package/dist/utils/media-wallet/use-erc20-balance.js +14 -18
- package/dist/utils/media-wallet/use-erc20-balance.js.map +1 -1
- package/dist/utils/use-drops.cjs +19 -10
- package/dist/utils/use-drops.cjs.map +1 -1
- package/dist/utils/use-drops.d.cts +3 -7
- package/dist/utils/use-drops.d.ts +3 -7
- package/dist/utils/use-drops.js +19 -11
- package/dist/utils/use-drops.js.map +1 -1
- package/dist/utils/use-pop.cjs +3 -2
- package/dist/utils/use-pop.cjs.map +1 -1
- package/dist/utils/use-pop.d.cts +1 -2
- package/dist/utils/use-pop.d.ts +1 -2
- package/dist/utils/use-pop.js +3 -2
- package/dist/utils/use-pop.js.map +1 -1
- package/package.json +3 -3
- package/dist/utils/drop/chain.cjs +0 -37
- package/dist/utils/drop/chain.cjs.map +0 -1
- package/dist/utils/drop/chain.d.cts +0 -5
- package/dist/utils/drop/chain.d.ts +0 -5
- package/dist/utils/drop/chain.js +0 -13
- package/dist/utils/drop/chain.js.map +0 -1
|
@@ -30,6 +30,7 @@ const APP_WALLET_DEFAULTS = {
|
|
|
30
30
|
deployProxyUrl: "/api/proxy/v1/paymaster/deploy"
|
|
31
31
|
};
|
|
32
32
|
function createAppWallet(config) {
|
|
33
|
+
const provider = () => config.getClient().provider;
|
|
33
34
|
const ownerStore = (0, import_starknet.createOwnerStore)({ storeKey: config.storeKey, changeEvent: config.changeEvent });
|
|
34
35
|
const passkeyOwner = (0, import_starknet.createPasskeyOwner)({
|
|
35
36
|
appName: config.appName,
|
|
@@ -44,17 +45,17 @@ function createAppWallet(config) {
|
|
|
44
45
|
knownCredentials: () => []
|
|
45
46
|
});
|
|
46
47
|
const walletConsent = (0, import_starknet.createSelfFundConsent)(
|
|
47
|
-
(address, calls) => (0, import_starknet.estimateSelfFundedFee)(
|
|
48
|
+
(address, calls) => (0, import_starknet.estimateSelfFundedFee)(provider(), address, calls)
|
|
48
49
|
);
|
|
49
50
|
const mediaWallet = (0, import_starknet.createMediaWallet)({
|
|
50
51
|
store: ownerStore,
|
|
51
52
|
passkey: passkeyOwner,
|
|
52
53
|
executor: (0, import_starknet.sponsoredExecutor)({
|
|
53
|
-
provider
|
|
54
|
+
provider,
|
|
54
55
|
proxyUrl: config.sponsoredInvokeUrl ?? APP_WALLET_DEFAULTS.sponsoredInvokeUrl,
|
|
55
56
|
consent: walletConsent
|
|
56
57
|
}),
|
|
57
|
-
provider
|
|
58
|
+
provider,
|
|
58
59
|
backendUrl: config.backendUrl ?? APP_WALLET_DEFAULTS.backendUrl,
|
|
59
60
|
deployProxyUrl: config.deployProxyUrl ?? APP_WALLET_DEFAULTS.deployProxyUrl
|
|
60
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/app-wallet.ts"],"sourcesContent":["import {\n createMediaWallet,\n createOwnerStore,\n createPasskeyOwner,\n createSelfFundConsent,\n estimateSelfFundedFee,\n sponsoredExecutor,\n type
|
|
1
|
+
{"version":3,"sources":["../../src/utils/app-wallet.ts"],"sourcesContent":["import {\n createMediaWallet,\n createOwnerStore,\n createPasskeyOwner,\n createSelfFundConsent,\n estimateSelfFundedFee,\n sponsoredExecutor,\n type MedialaneClient,\n} from \"@medialane/sdk/starknet\";\n\nexport interface AppWalletConfig {\n appName: string;\n relyingPartyId: () => string;\n storeKey: string;\n changeEvent: string;\n prfSalt: string;\n hkdfInfo: string;\n getClient: () => MedialaneClient;\n loadAccountEmail: () => string | null;\n backendUrl?: string;\n sponsoredInvokeUrl?: string;\n deployProxyUrl?: string;\n}\n\nconst encode = (value: string): Uint8Array<ArrayBuffer> => new TextEncoder().encode(value) as Uint8Array<ArrayBuffer>;\n\nexport const APP_WALLET_DEFAULTS = {\n backendUrl: \"/api/proxy\",\n sponsoredInvokeUrl: \"/api/proxy/v1/paymaster/invoke\",\n deployProxyUrl: \"/api/proxy/v1/paymaster/deploy\",\n} as const;\n\nexport function createAppWallet(config: AppWalletConfig) {\n const provider = () => config.getClient().provider;\n const ownerStore = createOwnerStore({ storeKey: config.storeKey, changeEvent: config.changeEvent });\n\n const passkeyOwner = createPasskeyOwner({\n appName: config.appName,\n relyingPartyName: config.appName,\n relyingPartyId: config.relyingPartyId,\n prfSalt: encode(config.prfSalt),\n hkdfInfo: encode(config.hkdfInfo),\n passkeyUser: async () => {\n const name = config.loadAccountEmail() ?? config.appName;\n return { id: crypto.getRandomValues(new Uint8Array(16)), name, displayName: name };\n },\n knownCredentials: () => [],\n });\n\n const walletConsent = createSelfFundConsent((address, calls) =>\n estimateSelfFundedFee(provider(), address, calls),\n );\n\n const mediaWallet = createMediaWallet({\n store: ownerStore,\n passkey: passkeyOwner,\n executor: sponsoredExecutor({\n provider,\n proxyUrl: config.sponsoredInvokeUrl ?? APP_WALLET_DEFAULTS.sponsoredInvokeUrl,\n consent: walletConsent,\n }),\n provider,\n backendUrl: config.backendUrl ?? APP_WALLET_DEFAULTS.backendUrl,\n deployProxyUrl: config.deployProxyUrl ?? APP_WALLET_DEFAULTS.deployProxyUrl,\n });\n\n return { ownerStore, passkeyOwner, walletConsent, mediaWallet };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAQO;AAgBP,MAAM,SAAS,CAAC,UAA2C,IAAI,YAAY,EAAE,OAAO,KAAK;AAElF,MAAM,sBAAsB;AAAA,EACjC,YAAY;AAAA,EACZ,oBAAoB;AAAA,EACpB,gBAAgB;AAClB;AAEO,SAAS,gBAAgB,QAAyB;AACvD,QAAM,WAAW,MAAM,OAAO,UAAU,EAAE;AAC1C,QAAM,iBAAa,kCAAiB,EAAE,UAAU,OAAO,UAAU,aAAa,OAAO,YAAY,CAAC;AAElG,QAAM,mBAAe,oCAAmB;AAAA,IACtC,SAAS,OAAO;AAAA,IAChB,kBAAkB,OAAO;AAAA,IACzB,gBAAgB,OAAO;AAAA,IACvB,SAAS,OAAO,OAAO,OAAO;AAAA,IAC9B,UAAU,OAAO,OAAO,QAAQ;AAAA,IAChC,aAAa,YAAY;AACvB,YAAM,OAAO,OAAO,iBAAiB,KAAK,OAAO;AACjD,aAAO,EAAE,IAAI,OAAO,gBAAgB,IAAI,WAAW,EAAE,CAAC,GAAG,MAAM,aAAa,KAAK;AAAA,IACnF;AAAA,IACA,kBAAkB,MAAM,CAAC;AAAA,EAC3B,CAAC;AAED,QAAM,oBAAgB;AAAA,IAAsB,CAAC,SAAS,cACpD,uCAAsB,SAAS,GAAG,SAAS,KAAK;AAAA,EAClD;AAEA,QAAM,kBAAc,mCAAkB;AAAA,IACpC,OAAO;AAAA,IACP,SAAS;AAAA,IACT,cAAU,mCAAkB;AAAA,MAC1B;AAAA,MACA,UAAU,OAAO,sBAAsB,oBAAoB;AAAA,MAC3D,SAAS;AAAA,IACX,CAAC;AAAA,IACD;AAAA,IACA,YAAY,OAAO,cAAc,oBAAoB;AAAA,IACrD,gBAAgB,OAAO,kBAAkB,oBAAoB;AAAA,EAC/D,CAAC;AAED,SAAO,EAAE,YAAY,cAAc,eAAe,YAAY;AAChE;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _medialane_sdk_starknet from '@medialane/sdk/starknet';
|
|
2
|
-
import {
|
|
2
|
+
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
3
|
|
|
4
4
|
interface AppWalletConfig {
|
|
5
5
|
appName: string;
|
|
@@ -8,7 +8,7 @@ interface AppWalletConfig {
|
|
|
8
8
|
changeEvent: string;
|
|
9
9
|
prfSalt: string;
|
|
10
10
|
hkdfInfo: string;
|
|
11
|
-
|
|
11
|
+
getClient: () => MedialaneClient;
|
|
12
12
|
loadAccountEmail: () => string | null;
|
|
13
13
|
backendUrl?: string;
|
|
14
14
|
sponsoredInvokeUrl?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _medialane_sdk_starknet from '@medialane/sdk/starknet';
|
|
2
|
-
import {
|
|
2
|
+
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
3
|
|
|
4
4
|
interface AppWalletConfig {
|
|
5
5
|
appName: string;
|
|
@@ -8,7 +8,7 @@ interface AppWalletConfig {
|
|
|
8
8
|
changeEvent: string;
|
|
9
9
|
prfSalt: string;
|
|
10
10
|
hkdfInfo: string;
|
|
11
|
-
|
|
11
|
+
getClient: () => MedialaneClient;
|
|
12
12
|
loadAccountEmail: () => string | null;
|
|
13
13
|
backendUrl?: string;
|
|
14
14
|
sponsoredInvokeUrl?: string;
|
package/dist/utils/app-wallet.js
CHANGED
|
@@ -13,6 +13,7 @@ const APP_WALLET_DEFAULTS = {
|
|
|
13
13
|
deployProxyUrl: "/api/proxy/v1/paymaster/deploy"
|
|
14
14
|
};
|
|
15
15
|
function createAppWallet(config) {
|
|
16
|
+
const provider = () => config.getClient().provider;
|
|
16
17
|
const ownerStore = createOwnerStore({ storeKey: config.storeKey, changeEvent: config.changeEvent });
|
|
17
18
|
const passkeyOwner = createPasskeyOwner({
|
|
18
19
|
appName: config.appName,
|
|
@@ -27,17 +28,17 @@ function createAppWallet(config) {
|
|
|
27
28
|
knownCredentials: () => []
|
|
28
29
|
});
|
|
29
30
|
const walletConsent = createSelfFundConsent(
|
|
30
|
-
(address, calls) => estimateSelfFundedFee(
|
|
31
|
+
(address, calls) => estimateSelfFundedFee(provider(), address, calls)
|
|
31
32
|
);
|
|
32
33
|
const mediaWallet = createMediaWallet({
|
|
33
34
|
store: ownerStore,
|
|
34
35
|
passkey: passkeyOwner,
|
|
35
36
|
executor: sponsoredExecutor({
|
|
36
|
-
provider
|
|
37
|
+
provider,
|
|
37
38
|
proxyUrl: config.sponsoredInvokeUrl ?? APP_WALLET_DEFAULTS.sponsoredInvokeUrl,
|
|
38
39
|
consent: walletConsent
|
|
39
40
|
}),
|
|
40
|
-
provider
|
|
41
|
+
provider,
|
|
41
42
|
backendUrl: config.backendUrl ?? APP_WALLET_DEFAULTS.backendUrl,
|
|
42
43
|
deployProxyUrl: config.deployProxyUrl ?? APP_WALLET_DEFAULTS.deployProxyUrl
|
|
43
44
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/app-wallet.ts"],"sourcesContent":["import {\n createMediaWallet,\n createOwnerStore,\n createPasskeyOwner,\n createSelfFundConsent,\n estimateSelfFundedFee,\n sponsoredExecutor,\n type
|
|
1
|
+
{"version":3,"sources":["../../src/utils/app-wallet.ts"],"sourcesContent":["import {\n createMediaWallet,\n createOwnerStore,\n createPasskeyOwner,\n createSelfFundConsent,\n estimateSelfFundedFee,\n sponsoredExecutor,\n type MedialaneClient,\n} from \"@medialane/sdk/starknet\";\n\nexport interface AppWalletConfig {\n appName: string;\n relyingPartyId: () => string;\n storeKey: string;\n changeEvent: string;\n prfSalt: string;\n hkdfInfo: string;\n getClient: () => MedialaneClient;\n loadAccountEmail: () => string | null;\n backendUrl?: string;\n sponsoredInvokeUrl?: string;\n deployProxyUrl?: string;\n}\n\nconst encode = (value: string): Uint8Array<ArrayBuffer> => new TextEncoder().encode(value) as Uint8Array<ArrayBuffer>;\n\nexport const APP_WALLET_DEFAULTS = {\n backendUrl: \"/api/proxy\",\n sponsoredInvokeUrl: \"/api/proxy/v1/paymaster/invoke\",\n deployProxyUrl: \"/api/proxy/v1/paymaster/deploy\",\n} as const;\n\nexport function createAppWallet(config: AppWalletConfig) {\n const provider = () => config.getClient().provider;\n const ownerStore = createOwnerStore({ storeKey: config.storeKey, changeEvent: config.changeEvent });\n\n const passkeyOwner = createPasskeyOwner({\n appName: config.appName,\n relyingPartyName: config.appName,\n relyingPartyId: config.relyingPartyId,\n prfSalt: encode(config.prfSalt),\n hkdfInfo: encode(config.hkdfInfo),\n passkeyUser: async () => {\n const name = config.loadAccountEmail() ?? config.appName;\n return { id: crypto.getRandomValues(new Uint8Array(16)), name, displayName: name };\n },\n knownCredentials: () => [],\n });\n\n const walletConsent = createSelfFundConsent((address, calls) =>\n estimateSelfFundedFee(provider(), address, calls),\n );\n\n const mediaWallet = createMediaWallet({\n store: ownerStore,\n passkey: passkeyOwner,\n executor: sponsoredExecutor({\n provider,\n proxyUrl: config.sponsoredInvokeUrl ?? APP_WALLET_DEFAULTS.sponsoredInvokeUrl,\n consent: walletConsent,\n }),\n provider,\n backendUrl: config.backendUrl ?? APP_WALLET_DEFAULTS.backendUrl,\n deployProxyUrl: config.deployProxyUrl ?? APP_WALLET_DEFAULTS.deployProxyUrl,\n });\n\n return { ownerStore, passkeyOwner, walletConsent, mediaWallet };\n}\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAgBP,MAAM,SAAS,CAAC,UAA2C,IAAI,YAAY,EAAE,OAAO,KAAK;AAElF,MAAM,sBAAsB;AAAA,EACjC,YAAY;AAAA,EACZ,oBAAoB;AAAA,EACpB,gBAAgB;AAClB;AAEO,SAAS,gBAAgB,QAAyB;AACvD,QAAM,WAAW,MAAM,OAAO,UAAU,EAAE;AAC1C,QAAM,aAAa,iBAAiB,EAAE,UAAU,OAAO,UAAU,aAAa,OAAO,YAAY,CAAC;AAElG,QAAM,eAAe,mBAAmB;AAAA,IACtC,SAAS,OAAO;AAAA,IAChB,kBAAkB,OAAO;AAAA,IACzB,gBAAgB,OAAO;AAAA,IACvB,SAAS,OAAO,OAAO,OAAO;AAAA,IAC9B,UAAU,OAAO,OAAO,QAAQ;AAAA,IAChC,aAAa,YAAY;AACvB,YAAM,OAAO,OAAO,iBAAiB,KAAK,OAAO;AACjD,aAAO,EAAE,IAAI,OAAO,gBAAgB,IAAI,WAAW,EAAE,CAAC,GAAG,MAAM,aAAa,KAAK;AAAA,IACnF;AAAA,IACA,kBAAkB,MAAM,CAAC;AAAA,EAC3B,CAAC;AAED,QAAM,gBAAgB;AAAA,IAAsB,CAAC,SAAS,UACpD,sBAAsB,SAAS,GAAG,SAAS,KAAK;AAAA,EAClD;AAEA,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU,kBAAkB;AAAA,MAC1B;AAAA,MACA,UAAU,OAAO,sBAAsB,oBAAoB;AAAA,MAC3D,SAAS;AAAA,IACX,CAAC;AAAA,IACD;AAAA,IACA,YAAY,OAAO,cAAc,oBAAoB;AAAA,IACrD,gBAAgB,OAAO,kBAAkB,oBAAoB;AAAA,EAC/D,CAAC;AAED,SAAO,EAAE,YAAY,cAAc,eAAe,YAAY;AAChE;","names":[]}
|
|
@@ -39,7 +39,7 @@ async function launchDrop(deps, input) {
|
|
|
39
39
|
...input.description ? { description: input.description } : {},
|
|
40
40
|
...input.image ? { image: input.image } : {}
|
|
41
41
|
});
|
|
42
|
-
const { txHash, receipt } = await (0, import_starknet.executeIntent)(deps.
|
|
42
|
+
const { txHash, receipt } = await (0, import_starknet.executeIntent)(deps.signer, deps.client, res.data);
|
|
43
43
|
const collection = (0, import_starknet.deployedCollectionFromReceipt)(receipt, "drop-collection");
|
|
44
44
|
if (!collection) throw new Error("Your drop launched, but its address wasn't found yet. Check My drops in a minute.");
|
|
45
45
|
return { collection, txHash };
|
|
@@ -51,12 +51,12 @@ async function mintDrop(deps, input) {
|
|
|
51
51
|
quantity: input.quantity.toString(),
|
|
52
52
|
...input.proof ? { proof: input.proof } : {}
|
|
53
53
|
});
|
|
54
|
-
const { txHash, receipt } = await (0, import_starknet.executeIntent)(deps.
|
|
54
|
+
const { txHash, receipt } = await (0, import_starknet.executeIntent)(deps.signer, deps.client, res.data);
|
|
55
55
|
return { txHash, tokenIds: (0, import_receipt.claimedTokenIds)(receipt, input.collection) };
|
|
56
56
|
}
|
|
57
57
|
async function manageDrop(deps, params) {
|
|
58
58
|
const res = await deps.client.api.createDropManageIntent(params);
|
|
59
|
-
const { txHash } = await (0, import_starknet.executeIntent)(deps.
|
|
59
|
+
const { txHash } = await (0, import_starknet.executeIntent)(deps.signer, deps.client, res.data);
|
|
60
60
|
return { txHash };
|
|
61
61
|
}
|
|
62
62
|
async function saveExclusiveContent(client, collection, content) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/drop/actions.ts"],"sourcesContent":["import type { CreateDropManageIntentParams, DropTermsBody } from \"@medialane/sdk\";\nimport { deployedCollectionFromReceipt, executeIntent, type MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { claimedTokenIds } from \"./receipt.js\";\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/drop/actions.ts"],"sourcesContent":["import type { CreateDropManageIntentParams, DropTermsBody } from \"@medialane/sdk\";\nimport { deployedCollectionFromReceipt, executeIntent, type MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { claimedTokenIds } from \"./receipt.js\";\nimport type { DropSigner } from \"./types.js\";\n\nexport interface DropDeps {\n client: MedialaneClient;\n signer: DropSigner;\n}\n\nexport async function launchDrop(\n deps: DropDeps,\n input: {\n owner: string; name: string; symbol: string; baseUri: string; maxSupply: number;\n terms: DropTermsBody; allowlistRoot?: string; description?: string; image?: string;\n },\n): Promise<{ collection: string; txHash: string }> {\n const res = await deps.client.api.createCollectionIntent({\n owner: input.owner,\n name: input.name,\n symbol: input.symbol,\n baseUri: input.baseUri,\n service: \"drop-collection\",\n maxSupply: String(input.maxSupply),\n terms: input.terms,\n ...(input.allowlistRoot ? { allowlistRoot: input.allowlistRoot } : {}),\n ...(input.description ? { description: input.description } : {}),\n ...(input.image ? { image: input.image } : {}),\n });\n const { txHash, receipt } = await executeIntent(deps.signer, deps.client, res.data);\n const collection = deployedCollectionFromReceipt(receipt, \"drop-collection\");\n if (!collection) throw new Error(\"Your drop launched, but its address wasn't found yet. Check My drops in a minute.\");\n return { collection, txHash };\n}\n\nexport async function mintDrop(\n deps: DropDeps,\n input: { claimer: string; collection: string; quantity: bigint; proof: string[] | null },\n): Promise<{ txHash: string; tokenIds: string[] }> {\n const res = await deps.client.api.createDropClaimIntent({\n claimer: input.claimer,\n collection: input.collection,\n quantity: input.quantity.toString(),\n ...(input.proof ? { proof: input.proof } : {}),\n });\n const { txHash, receipt } = await executeIntent(deps.signer, deps.client, res.data);\n return { txHash, tokenIds: claimedTokenIds(receipt, input.collection) };\n}\n\nexport async function manageDrop(deps: DropDeps, params: CreateDropManageIntentParams): Promise<{ txHash: string }> {\n const res = await deps.client.api.createDropManageIntent(params);\n const { txHash } = await executeIntent(deps.signer, deps.client, res.data);\n return { txHash };\n}\n\nexport interface ExclusiveContent {\n title: string;\n url: string;\n type: string;\n}\n\nexport async function saveExclusiveContent(client: MedialaneClient, collection: string, content: ExclusiveContent | null): Promise<void> {\n await client.api.updateCollectionProfile(collection, {\n gatedContentTitle: content?.title || null,\n gatedContentUrl: content?.url || null,\n gatedContentType: (content?.type || null) as never,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAmF;AACnF,qBAAgC;AAQhC,eAAsB,WACpB,MACA,OAIiD;AACjD,QAAM,MAAM,MAAM,KAAK,OAAO,IAAI,uBAAuB;AAAA,IACvD,OAAO,MAAM;AAAA,IACb,MAAM,MAAM;AAAA,IACZ,QAAQ,MAAM;AAAA,IACd,SAAS,MAAM;AAAA,IACf,SAAS;AAAA,IACT,WAAW,OAAO,MAAM,SAAS;AAAA,IACjC,OAAO,MAAM;AAAA,IACb,GAAI,MAAM,gBAAgB,EAAE,eAAe,MAAM,cAAc,IAAI,CAAC;AAAA,IACpE,GAAI,MAAM,cAAc,EAAE,aAAa,MAAM,YAAY,IAAI,CAAC;AAAA,IAC9D,GAAI,MAAM,QAAQ,EAAE,OAAO,MAAM,MAAM,IAAI,CAAC;AAAA,EAC9C,CAAC;AACD,QAAM,EAAE,QAAQ,QAAQ,IAAI,UAAM,+BAAc,KAAK,QAAQ,KAAK,QAAQ,IAAI,IAAI;AAClF,QAAM,iBAAa,+CAA8B,SAAS,iBAAiB;AAC3E,MAAI,CAAC,WAAY,OAAM,IAAI,MAAM,mFAAmF;AACpH,SAAO,EAAE,YAAY,OAAO;AAC9B;AAEA,eAAsB,SACpB,MACA,OACiD;AACjD,QAAM,MAAM,MAAM,KAAK,OAAO,IAAI,sBAAsB;AAAA,IACtD,SAAS,MAAM;AAAA,IACf,YAAY,MAAM;AAAA,IAClB,UAAU,MAAM,SAAS,SAAS;AAAA,IAClC,GAAI,MAAM,QAAQ,EAAE,OAAO,MAAM,MAAM,IAAI,CAAC;AAAA,EAC9C,CAAC;AACD,QAAM,EAAE,QAAQ,QAAQ,IAAI,UAAM,+BAAc,KAAK,QAAQ,KAAK,QAAQ,IAAI,IAAI;AAClF,SAAO,EAAE,QAAQ,cAAU,gCAAgB,SAAS,MAAM,UAAU,EAAE;AACxE;AAEA,eAAsB,WAAW,MAAgB,QAAmE;AAClH,QAAM,MAAM,MAAM,KAAK,OAAO,IAAI,uBAAuB,MAAM;AAC/D,QAAM,EAAE,OAAO,IAAI,UAAM,+BAAc,KAAK,QAAQ,KAAK,QAAQ,IAAI,IAAI;AACzE,SAAO,EAAE,OAAO;AAClB;AAQA,eAAsB,qBAAqB,QAAyB,YAAoB,SAAiD;AACvI,QAAM,OAAO,IAAI,wBAAwB,YAAY;AAAA,IACnD,mBAAmB,SAAS,SAAS;AAAA,IACrC,iBAAiB,SAAS,OAAO;AAAA,IACjC,kBAAmB,SAAS,QAAQ;AAAA,EACtC,CAAC;AACH;","names":[]}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { DropTermsBody, CreateDropManageIntentParams } from '@medialane/sdk';
|
|
2
2
|
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
|
-
import {
|
|
4
|
-
import 'starknet';
|
|
3
|
+
import { DropSigner } from './types.cjs';
|
|
5
4
|
import '../../components/fast-mint/types.cjs';
|
|
6
5
|
import 'react';
|
|
6
|
+
import 'starknet';
|
|
7
7
|
|
|
8
8
|
interface DropDeps {
|
|
9
9
|
client: MedialaneClient;
|
|
10
|
-
provider: DropProvider;
|
|
11
10
|
signer: DropSigner;
|
|
12
11
|
}
|
|
13
12
|
declare function launchDrop(deps: DropDeps, input: {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { DropTermsBody, CreateDropManageIntentParams } from '@medialane/sdk';
|
|
2
2
|
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
|
-
import {
|
|
4
|
-
import 'starknet';
|
|
3
|
+
import { DropSigner } from './types.js';
|
|
5
4
|
import '../../components/fast-mint/types.js';
|
|
6
5
|
import 'react';
|
|
6
|
+
import 'starknet';
|
|
7
7
|
|
|
8
8
|
interface DropDeps {
|
|
9
9
|
client: MedialaneClient;
|
|
10
|
-
provider: DropProvider;
|
|
11
10
|
signer: DropSigner;
|
|
12
11
|
}
|
|
13
12
|
declare function launchDrop(deps: DropDeps, input: {
|
|
@@ -13,7 +13,7 @@ async function launchDrop(deps, input) {
|
|
|
13
13
|
...input.description ? { description: input.description } : {},
|
|
14
14
|
...input.image ? { image: input.image } : {}
|
|
15
15
|
});
|
|
16
|
-
const { txHash, receipt } = await executeIntent(deps.
|
|
16
|
+
const { txHash, receipt } = await executeIntent(deps.signer, deps.client, res.data);
|
|
17
17
|
const collection = deployedCollectionFromReceipt(receipt, "drop-collection");
|
|
18
18
|
if (!collection) throw new Error("Your drop launched, but its address wasn't found yet. Check My drops in a minute.");
|
|
19
19
|
return { collection, txHash };
|
|
@@ -25,12 +25,12 @@ async function mintDrop(deps, input) {
|
|
|
25
25
|
quantity: input.quantity.toString(),
|
|
26
26
|
...input.proof ? { proof: input.proof } : {}
|
|
27
27
|
});
|
|
28
|
-
const { txHash, receipt } = await executeIntent(deps.
|
|
28
|
+
const { txHash, receipt } = await executeIntent(deps.signer, deps.client, res.data);
|
|
29
29
|
return { txHash, tokenIds: claimedTokenIds(receipt, input.collection) };
|
|
30
30
|
}
|
|
31
31
|
async function manageDrop(deps, params) {
|
|
32
32
|
const res = await deps.client.api.createDropManageIntent(params);
|
|
33
|
-
const { txHash } = await executeIntent(deps.
|
|
33
|
+
const { txHash } = await executeIntent(deps.signer, deps.client, res.data);
|
|
34
34
|
return { txHash };
|
|
35
35
|
}
|
|
36
36
|
async function saveExclusiveContent(client, collection, content) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/drop/actions.ts"],"sourcesContent":["import type { CreateDropManageIntentParams, DropTermsBody } from \"@medialane/sdk\";\nimport { deployedCollectionFromReceipt, executeIntent, type MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { claimedTokenIds } from \"./receipt.js\";\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/drop/actions.ts"],"sourcesContent":["import type { CreateDropManageIntentParams, DropTermsBody } from \"@medialane/sdk\";\nimport { deployedCollectionFromReceipt, executeIntent, type MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { claimedTokenIds } from \"./receipt.js\";\nimport type { DropSigner } from \"./types.js\";\n\nexport interface DropDeps {\n client: MedialaneClient;\n signer: DropSigner;\n}\n\nexport async function launchDrop(\n deps: DropDeps,\n input: {\n owner: string; name: string; symbol: string; baseUri: string; maxSupply: number;\n terms: DropTermsBody; allowlistRoot?: string; description?: string; image?: string;\n },\n): Promise<{ collection: string; txHash: string }> {\n const res = await deps.client.api.createCollectionIntent({\n owner: input.owner,\n name: input.name,\n symbol: input.symbol,\n baseUri: input.baseUri,\n service: \"drop-collection\",\n maxSupply: String(input.maxSupply),\n terms: input.terms,\n ...(input.allowlistRoot ? { allowlistRoot: input.allowlistRoot } : {}),\n ...(input.description ? { description: input.description } : {}),\n ...(input.image ? { image: input.image } : {}),\n });\n const { txHash, receipt } = await executeIntent(deps.signer, deps.client, res.data);\n const collection = deployedCollectionFromReceipt(receipt, \"drop-collection\");\n if (!collection) throw new Error(\"Your drop launched, but its address wasn't found yet. Check My drops in a minute.\");\n return { collection, txHash };\n}\n\nexport async function mintDrop(\n deps: DropDeps,\n input: { claimer: string; collection: string; quantity: bigint; proof: string[] | null },\n): Promise<{ txHash: string; tokenIds: string[] }> {\n const res = await deps.client.api.createDropClaimIntent({\n claimer: input.claimer,\n collection: input.collection,\n quantity: input.quantity.toString(),\n ...(input.proof ? { proof: input.proof } : {}),\n });\n const { txHash, receipt } = await executeIntent(deps.signer, deps.client, res.data);\n return { txHash, tokenIds: claimedTokenIds(receipt, input.collection) };\n}\n\nexport async function manageDrop(deps: DropDeps, params: CreateDropManageIntentParams): Promise<{ txHash: string }> {\n const res = await deps.client.api.createDropManageIntent(params);\n const { txHash } = await executeIntent(deps.signer, deps.client, res.data);\n return { txHash };\n}\n\nexport interface ExclusiveContent {\n title: string;\n url: string;\n type: string;\n}\n\nexport async function saveExclusiveContent(client: MedialaneClient, collection: string, content: ExclusiveContent | null): Promise<void> {\n await client.api.updateCollectionProfile(collection, {\n gatedContentTitle: content?.title || null,\n gatedContentUrl: content?.url || null,\n gatedContentType: (content?.type || null) as never,\n });\n}\n"],"mappings":"AACA,SAAS,+BAA+B,qBAA2C;AACnF,SAAS,uBAAuB;AAQhC,eAAsB,WACpB,MACA,OAIiD;AACjD,QAAM,MAAM,MAAM,KAAK,OAAO,IAAI,uBAAuB;AAAA,IACvD,OAAO,MAAM;AAAA,IACb,MAAM,MAAM;AAAA,IACZ,QAAQ,MAAM;AAAA,IACd,SAAS,MAAM;AAAA,IACf,SAAS;AAAA,IACT,WAAW,OAAO,MAAM,SAAS;AAAA,IACjC,OAAO,MAAM;AAAA,IACb,GAAI,MAAM,gBAAgB,EAAE,eAAe,MAAM,cAAc,IAAI,CAAC;AAAA,IACpE,GAAI,MAAM,cAAc,EAAE,aAAa,MAAM,YAAY,IAAI,CAAC;AAAA,IAC9D,GAAI,MAAM,QAAQ,EAAE,OAAO,MAAM,MAAM,IAAI,CAAC;AAAA,EAC9C,CAAC;AACD,QAAM,EAAE,QAAQ,QAAQ,IAAI,MAAM,cAAc,KAAK,QAAQ,KAAK,QAAQ,IAAI,IAAI;AAClF,QAAM,aAAa,8BAA8B,SAAS,iBAAiB;AAC3E,MAAI,CAAC,WAAY,OAAM,IAAI,MAAM,mFAAmF;AACpH,SAAO,EAAE,YAAY,OAAO;AAC9B;AAEA,eAAsB,SACpB,MACA,OACiD;AACjD,QAAM,MAAM,MAAM,KAAK,OAAO,IAAI,sBAAsB;AAAA,IACtD,SAAS,MAAM;AAAA,IACf,YAAY,MAAM;AAAA,IAClB,UAAU,MAAM,SAAS,SAAS;AAAA,IAClC,GAAI,MAAM,QAAQ,EAAE,OAAO,MAAM,MAAM,IAAI,CAAC;AAAA,EAC9C,CAAC;AACD,QAAM,EAAE,QAAQ,QAAQ,IAAI,MAAM,cAAc,KAAK,QAAQ,KAAK,QAAQ,IAAI,IAAI;AAClF,SAAO,EAAE,QAAQ,UAAU,gBAAgB,SAAS,MAAM,UAAU,EAAE;AACxE;AAEA,eAAsB,WAAW,MAAgB,QAAmE;AAClH,QAAM,MAAM,MAAM,KAAK,OAAO,IAAI,uBAAuB,MAAM;AAC/D,QAAM,EAAE,OAAO,IAAI,MAAM,cAAc,KAAK,QAAQ,KAAK,QAAQ,IAAI,IAAI;AACzE,SAAO,EAAE,OAAO;AAClB;AAQA,eAAsB,qBAAqB,QAAyB,YAAoB,SAAiD;AACvI,QAAM,OAAO,IAAI,wBAAwB,YAAY;AAAA,IACnD,mBAAmB,SAAS,SAAS;AAAA,IACrC,iBAAiB,SAAS,OAAO;AAAA,IACjC,kBAAmB,SAAS,QAAQ;AAAA,EACtC,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/drop/types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/drop/types.ts"],"sourcesContent":["import type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { FastMintSigner } from \"../../components/fast-mint/types.js\";\n\nexport type DropSigner = FastMintSigner;\n\n/** What every drop screen takes from the app. */\nexport interface DropAppProps {\n getClient: () => MedialaneClient;\n getSigner: () => Promise<DropSigner> | DropSigner;\n walletAddress: string | null;\n onRequireWallet: () => void;\n connectLabel?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MedialaneClient, ReceiptProvider } from '@medialane/sdk/starknet';
|
|
1
|
+
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
2
|
import { FastMintSigner } from '../../components/fast-mint/types.cjs';
|
|
4
3
|
import 'react';
|
|
4
|
+
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
|
|
7
7
|
type DropSigner = FastMintSigner;
|
|
8
|
-
/** Receipts for confirmations, contract reads for live drop state. */
|
|
9
|
-
type DropProvider = ReceiptProvider & Pick<ProviderInterface, "callContract">;
|
|
10
8
|
/** What every drop screen takes from the app. */
|
|
11
9
|
interface DropAppProps {
|
|
12
10
|
getClient: () => MedialaneClient;
|
|
13
|
-
provider: DropProvider;
|
|
14
11
|
getSigner: () => Promise<DropSigner> | DropSigner;
|
|
15
12
|
walletAddress: string | null;
|
|
16
13
|
onRequireWallet: () => void;
|
|
17
14
|
connectLabel?: string;
|
|
18
15
|
}
|
|
19
16
|
|
|
20
|
-
export type { DropAppProps,
|
|
17
|
+
export type { DropAppProps, DropSigner };
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MedialaneClient, ReceiptProvider } from '@medialane/sdk/starknet';
|
|
1
|
+
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
2
|
import { FastMintSigner } from '../../components/fast-mint/types.js';
|
|
4
3
|
import 'react';
|
|
4
|
+
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
|
|
7
7
|
type DropSigner = FastMintSigner;
|
|
8
|
-
/** Receipts for confirmations, contract reads for live drop state. */
|
|
9
|
-
type DropProvider = ReceiptProvider & Pick<ProviderInterface, "callContract">;
|
|
10
8
|
/** What every drop screen takes from the app. */
|
|
11
9
|
interface DropAppProps {
|
|
12
10
|
getClient: () => MedialaneClient;
|
|
13
|
-
provider: DropProvider;
|
|
14
11
|
getSigner: () => Promise<DropSigner> | DropSigner;
|
|
15
12
|
walletAddress: string | null;
|
|
16
13
|
onRequireWallet: () => void;
|
|
17
14
|
connectLabel?: string;
|
|
18
15
|
}
|
|
19
16
|
|
|
20
|
-
export type { DropAppProps,
|
|
17
|
+
export type { DropAppProps, DropSigner };
|
|
@@ -29,29 +29,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
30
|
var use_erc20_balance_exports = {};
|
|
31
31
|
__export(use_erc20_balance_exports, {
|
|
32
|
+
hasSufficientBalance: () => hasSufficientBalance,
|
|
32
33
|
useErc20Balance: () => useErc20Balance,
|
|
33
34
|
useTokenBalance: () => useTokenBalance
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(use_erc20_balance_exports);
|
|
36
37
|
var import_swr = __toESM(require("swr"), 1);
|
|
37
38
|
var import_sdk = require("@medialane/sdk");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
contractAddress: tokenAddress,
|
|
42
|
-
entrypoint: "balanceOf",
|
|
43
|
-
calldata: [holderAddress]
|
|
44
|
-
},
|
|
45
|
-
"latest"
|
|
46
|
-
);
|
|
47
|
-
const low = BigInt(result[0]);
|
|
48
|
-
const high = BigInt(result[1]);
|
|
49
|
-
return low + (high << 128n);
|
|
50
|
-
}
|
|
51
|
-
function useErc20Balance(provider, tokenAddress, holderAddress) {
|
|
39
|
+
var import_starknet = require("@medialane/sdk/starknet");
|
|
40
|
+
function useErc20Balance(getClient, tokenAddress, holderAddress) {
|
|
52
41
|
const { data, error, isLoading } = (0, import_swr.default)(
|
|
53
42
|
tokenAddress && holderAddress ? ["erc20-balance", tokenAddress, holderAddress] : null,
|
|
54
|
-
([, addr, holder]) =>
|
|
43
|
+
([, addr, holder]) => (0, import_starknet.erc20Balance)(getClient().provider, addr, holder),
|
|
55
44
|
{
|
|
56
45
|
refreshInterval: 3e4,
|
|
57
46
|
revalidateOnFocus: false,
|
|
@@ -62,13 +51,21 @@ function useErc20Balance(provider, tokenAddress, holderAddress) {
|
|
|
62
51
|
);
|
|
63
52
|
return { rawBalance: data ?? null, isLoading, error };
|
|
64
53
|
}
|
|
65
|
-
function useTokenBalance(
|
|
54
|
+
function useTokenBalance(getClient, symbol, holderAddress) {
|
|
66
55
|
const token = symbol ? (0, import_sdk.getListableTokens)().find((t) => t.symbol === symbol) ?? null : null;
|
|
67
|
-
const { rawBalance, isLoading, error } = useErc20Balance(
|
|
56
|
+
const { rawBalance, isLoading, error } = useErc20Balance(getClient, token?.address ?? null, holderAddress);
|
|
68
57
|
return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };
|
|
69
58
|
}
|
|
59
|
+
function hasSufficientBalance(rawBalance, requiredHuman, decimals) {
|
|
60
|
+
if (rawBalance === null) return null;
|
|
61
|
+
const n = parseFloat(requiredHuman);
|
|
62
|
+
if (!requiredHuman || isNaN(n) || n <= 0) return null;
|
|
63
|
+
const required = BigInt((0, import_sdk.parseAmount)(requiredHuman, decimals));
|
|
64
|
+
return rawBalance >= required;
|
|
65
|
+
}
|
|
70
66
|
// Annotate the CommonJS export names for ESM import in node:
|
|
71
67
|
0 && (module.exports = {
|
|
68
|
+
hasSufficientBalance,
|
|
72
69
|
useErc20Balance,
|
|
73
70
|
useTokenBalance
|
|
74
71
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/media-wallet/use-erc20-balance.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/use-erc20-balance.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { getListableTokens, parseAmount } from \"@medialane/sdk\";\nimport { erc20Balance, type MedialaneClient } from \"@medialane/sdk/starknet\";\n\nexport function useErc20Balance(getClient: () => MedialaneClient, tokenAddress: string | null, holderAddress: string | null) {\n const { data, error, isLoading } = useSWR(\n tokenAddress && holderAddress ? [\"erc20-balance\", tokenAddress, holderAddress] : null,\n ([, addr, holder]) => erc20Balance(getClient().provider, addr, holder),\n {\n refreshInterval: 30_000,\n revalidateOnFocus: false,\n shouldRetryOnError: false,\n onError: () => {},\n }\n );\n return { rawBalance: data ?? null, isLoading, error };\n}\n\nexport function useTokenBalance(getClient: () => MedialaneClient, symbol: string | null, holderAddress: string | null) {\n const token = symbol ? getListableTokens().find((t) => t.symbol === symbol) ?? null : null;\n const { rawBalance, isLoading, error } = useErc20Balance(getClient, token?.address ?? null, holderAddress);\n return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };\n}\n\nexport function hasSufficientBalance(\n rawBalance: bigint | null,\n requiredHuman: string,\n decimals: number\n): boolean | null {\n if (rawBalance === null) return null;\n const n = parseFloat(requiredHuman);\n if (!requiredHuman || isNaN(n) || n <= 0) return null;\n const required = BigInt(parseAmount(requiredHuman, decimals));\n return rawBalance >= required;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,iBAA+C;AAC/C,sBAAmD;AAE5C,SAAS,gBAAgB,WAAkC,cAA6B,eAA8B;AAC3H,QAAM,EAAE,MAAM,OAAO,UAAU,QAAI,WAAAA;AAAA,IACjC,gBAAgB,gBAAgB,CAAC,iBAAiB,cAAc,aAAa,IAAI;AAAA,IACjF,CAAC,CAAC,EAAE,MAAM,MAAM,UAAM,8BAAa,UAAU,EAAE,UAAU,MAAM,MAAM;AAAA,IACrE;AAAA,MACE,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,SAAS,MAAM;AAAA,MAAC;AAAA,IAClB;AAAA,EACF;AACA,SAAO,EAAE,YAAY,QAAQ,MAAM,WAAW,MAAM;AACtD;AAEO,SAAS,gBAAgB,WAAkC,QAAuB,eAA8B;AACrH,QAAM,QAAQ,aAAS,8BAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,MAAM,KAAK,OAAO;AACtF,QAAM,EAAE,YAAY,WAAW,MAAM,IAAI,gBAAgB,WAAW,OAAO,WAAW,MAAM,aAAa;AACzG,SAAO,EAAE,YAAY,WAAW,OAAO,UAAU,OAAO,YAAY,GAAG;AACzE;AAEO,SAAS,qBACd,YACA,eACA,UACgB;AAChB,MAAI,eAAe,KAAM,QAAO;AAChC,QAAM,IAAI,WAAW,aAAa;AAClC,MAAI,CAAC,iBAAiB,MAAM,CAAC,KAAK,KAAK,EAAG,QAAO;AACjD,QAAM,WAAW,WAAO,wBAAY,eAAe,QAAQ,CAAC;AAC5D,SAAO,cAAc;AACvB;","names":["useSWR"]}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
2
2
|
|
|
3
|
-
declare function useErc20Balance(
|
|
3
|
+
declare function useErc20Balance(getClient: () => MedialaneClient, tokenAddress: string | null, holderAddress: string | null): {
|
|
4
4
|
rawBalance: bigint | null;
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
error: any;
|
|
7
7
|
};
|
|
8
|
-
declare function useTokenBalance(
|
|
8
|
+
declare function useTokenBalance(getClient: () => MedialaneClient, symbol: string | null, holderAddress: string | null): {
|
|
9
9
|
rawBalance: bigint | null;
|
|
10
10
|
isLoading: boolean;
|
|
11
11
|
error: any;
|
|
12
12
|
decimals: 6 | 18 | 8;
|
|
13
13
|
};
|
|
14
|
+
declare function hasSufficientBalance(rawBalance: bigint | null, requiredHuman: string, decimals: number): boolean | null;
|
|
14
15
|
|
|
15
|
-
export { useErc20Balance, useTokenBalance };
|
|
16
|
+
export { hasSufficientBalance, useErc20Balance, useTokenBalance };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
2
2
|
|
|
3
|
-
declare function useErc20Balance(
|
|
3
|
+
declare function useErc20Balance(getClient: () => MedialaneClient, tokenAddress: string | null, holderAddress: string | null): {
|
|
4
4
|
rawBalance: bigint | null;
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
error: any;
|
|
7
7
|
};
|
|
8
|
-
declare function useTokenBalance(
|
|
8
|
+
declare function useTokenBalance(getClient: () => MedialaneClient, symbol: string | null, holderAddress: string | null): {
|
|
9
9
|
rawBalance: bigint | null;
|
|
10
10
|
isLoading: boolean;
|
|
11
11
|
error: any;
|
|
12
12
|
decimals: 6 | 18 | 8;
|
|
13
13
|
};
|
|
14
|
+
declare function hasSufficientBalance(rawBalance: bigint | null, requiredHuman: string, decimals: number): boolean | null;
|
|
14
15
|
|
|
15
|
-
export { useErc20Balance, useTokenBalance };
|
|
16
|
+
export { hasSufficientBalance, useErc20Balance, useTokenBalance };
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import useSWR from "swr";
|
|
3
|
-
import { getListableTokens } from "@medialane/sdk";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
{
|
|
7
|
-
contractAddress: tokenAddress,
|
|
8
|
-
entrypoint: "balanceOf",
|
|
9
|
-
calldata: [holderAddress]
|
|
10
|
-
},
|
|
11
|
-
"latest"
|
|
12
|
-
);
|
|
13
|
-
const low = BigInt(result[0]);
|
|
14
|
-
const high = BigInt(result[1]);
|
|
15
|
-
return low + (high << 128n);
|
|
16
|
-
}
|
|
17
|
-
function useErc20Balance(provider, tokenAddress, holderAddress) {
|
|
3
|
+
import { getListableTokens, parseAmount } from "@medialane/sdk";
|
|
4
|
+
import { erc20Balance } from "@medialane/sdk/starknet";
|
|
5
|
+
function useErc20Balance(getClient, tokenAddress, holderAddress) {
|
|
18
6
|
const { data, error, isLoading } = useSWR(
|
|
19
7
|
tokenAddress && holderAddress ? ["erc20-balance", tokenAddress, holderAddress] : null,
|
|
20
|
-
([, addr, holder]) =>
|
|
8
|
+
([, addr, holder]) => erc20Balance(getClient().provider, addr, holder),
|
|
21
9
|
{
|
|
22
10
|
refreshInterval: 3e4,
|
|
23
11
|
revalidateOnFocus: false,
|
|
@@ -28,12 +16,20 @@ function useErc20Balance(provider, tokenAddress, holderAddress) {
|
|
|
28
16
|
);
|
|
29
17
|
return { rawBalance: data ?? null, isLoading, error };
|
|
30
18
|
}
|
|
31
|
-
function useTokenBalance(
|
|
19
|
+
function useTokenBalance(getClient, symbol, holderAddress) {
|
|
32
20
|
const token = symbol ? getListableTokens().find((t) => t.symbol === symbol) ?? null : null;
|
|
33
|
-
const { rawBalance, isLoading, error } = useErc20Balance(
|
|
21
|
+
const { rawBalance, isLoading, error } = useErc20Balance(getClient, token?.address ?? null, holderAddress);
|
|
34
22
|
return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };
|
|
35
23
|
}
|
|
24
|
+
function hasSufficientBalance(rawBalance, requiredHuman, decimals) {
|
|
25
|
+
if (rawBalance === null) return null;
|
|
26
|
+
const n = parseFloat(requiredHuman);
|
|
27
|
+
if (!requiredHuman || isNaN(n) || n <= 0) return null;
|
|
28
|
+
const required = BigInt(parseAmount(requiredHuman, decimals));
|
|
29
|
+
return rawBalance >= required;
|
|
30
|
+
}
|
|
36
31
|
export {
|
|
32
|
+
hasSufficientBalance,
|
|
37
33
|
useErc20Balance,
|
|
38
34
|
useTokenBalance
|
|
39
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/media-wallet/use-erc20-balance.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/use-erc20-balance.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { getListableTokens, parseAmount } from \"@medialane/sdk\";\nimport { erc20Balance, type MedialaneClient } from \"@medialane/sdk/starknet\";\n\nexport function useErc20Balance(getClient: () => MedialaneClient, tokenAddress: string | null, holderAddress: string | null) {\n const { data, error, isLoading } = useSWR(\n tokenAddress && holderAddress ? [\"erc20-balance\", tokenAddress, holderAddress] : null,\n ([, addr, holder]) => erc20Balance(getClient().provider, addr, holder),\n {\n refreshInterval: 30_000,\n revalidateOnFocus: false,\n shouldRetryOnError: false,\n onError: () => {},\n }\n );\n return { rawBalance: data ?? null, isLoading, error };\n}\n\nexport function useTokenBalance(getClient: () => MedialaneClient, symbol: string | null, holderAddress: string | null) {\n const token = symbol ? getListableTokens().find((t) => t.symbol === symbol) ?? null : null;\n const { rawBalance, isLoading, error } = useErc20Balance(getClient, token?.address ?? null, holderAddress);\n return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };\n}\n\nexport function hasSufficientBalance(\n rawBalance: bigint | null,\n requiredHuman: string,\n decimals: number\n): boolean | null {\n if (rawBalance === null) return null;\n const n = parseFloat(requiredHuman);\n if (!requiredHuman || isNaN(n) || n <= 0) return null;\n const required = BigInt(parseAmount(requiredHuman, decimals));\n return rawBalance >= required;\n}\n"],"mappings":";AAEA,OAAO,YAAY;AACnB,SAAS,mBAAmB,mBAAmB;AAC/C,SAAS,oBAA0C;AAE5C,SAAS,gBAAgB,WAAkC,cAA6B,eAA8B;AAC3H,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI;AAAA,IACjC,gBAAgB,gBAAgB,CAAC,iBAAiB,cAAc,aAAa,IAAI;AAAA,IACjF,CAAC,CAAC,EAAE,MAAM,MAAM,MAAM,aAAa,UAAU,EAAE,UAAU,MAAM,MAAM;AAAA,IACrE;AAAA,MACE,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,SAAS,MAAM;AAAA,MAAC;AAAA,IAClB;AAAA,EACF;AACA,SAAO,EAAE,YAAY,QAAQ,MAAM,WAAW,MAAM;AACtD;AAEO,SAAS,gBAAgB,WAAkC,QAAuB,eAA8B;AACrH,QAAM,QAAQ,SAAS,kBAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,MAAM,KAAK,OAAO;AACtF,QAAM,EAAE,YAAY,WAAW,MAAM,IAAI,gBAAgB,WAAW,OAAO,WAAW,MAAM,aAAa;AACzG,SAAO,EAAE,YAAY,WAAW,OAAO,UAAU,OAAO,YAAY,GAAG;AACzE;AAEO,SAAS,qBACd,YACA,eACA,UACgB;AAChB,MAAI,eAAe,KAAM,QAAO;AAChC,QAAM,IAAI,WAAW,aAAa;AAClC,MAAI,CAAC,iBAAiB,MAAM,CAAC,KAAK,KAAK,EAAG,QAAO;AACjD,QAAM,WAAW,OAAO,YAAY,eAAe,QAAQ,CAAC;AAC5D,SAAO,cAAc;AACvB;","names":[]}
|
package/dist/utils/use-drops.cjs
CHANGED
|
@@ -29,6 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
30
|
var use_drops_exports = {};
|
|
31
31
|
__export(use_drops_exports, {
|
|
32
|
+
readDropState: () => readDropState,
|
|
32
33
|
useDrop: () => useDrop,
|
|
33
34
|
useDropChain: () => useDropChain,
|
|
34
35
|
useDropFee: () => useDropFee,
|
|
@@ -39,9 +40,9 @@ __export(use_drops_exports, {
|
|
|
39
40
|
});
|
|
40
41
|
module.exports = __toCommonJS(use_drops_exports);
|
|
41
42
|
var import_swr = __toESM(require("swr"), 1);
|
|
43
|
+
var import_sdk = require("@medialane/sdk");
|
|
42
44
|
var import_starknet = require("@medialane/sdk/starknet");
|
|
43
45
|
var import_use_medialane_client = require("./use-medialane-client.js");
|
|
44
|
-
var import_chain = require("./drop/chain.js");
|
|
45
46
|
const quiet = { revalidateOnFocus: false, shouldRetryOnError: false };
|
|
46
47
|
function useDrops(getClient, status) {
|
|
47
48
|
const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
|
|
@@ -73,19 +74,27 @@ function useDropFile(getClient, baseUri, name) {
|
|
|
73
74
|
const { data } = (0, import_swr.default)(baseUri ? ["drop-file", baseUri, name] : null, async () => (await client.api.resolveMetadata(`${baseUri}${name}`)).data, quiet);
|
|
74
75
|
return data ?? null;
|
|
75
76
|
}
|
|
76
|
-
function
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
async function readDropState(client, contract, wallet) {
|
|
78
|
+
const drop = await client.api.getDropState(contract);
|
|
79
|
+
if (!drop) throw new Error("Drop not found");
|
|
80
|
+
const [claimed, balance] = await Promise.all([
|
|
81
|
+
wallet ? (0, import_starknet.dropClaimedBy)(client.provider, contract, wallet) : Promise.resolve(null),
|
|
82
|
+
wallet && drop.price > 0n ? (0, import_starknet.erc20Balance)(client.provider, (0, import_sdk.normalizeAddress)("STARKNET", drop.paymentToken), (0, import_sdk.normalizeAddress)("STARKNET", wallet)) : Promise.resolve(null)
|
|
83
|
+
]);
|
|
84
|
+
return { drop, claimed, balance };
|
|
85
|
+
}
|
|
86
|
+
function useDropChain(getClient, contract, wallet) {
|
|
87
|
+
const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
|
|
88
|
+
const { data, mutate, error } = (0, import_swr.default)(
|
|
89
|
+
contract ? ["drop-chain", contract, wallet] : null,
|
|
90
|
+
() => readDropState(client, contract, wallet),
|
|
91
|
+
{ revalidateOnFocus: true, refreshInterval: 15e3 }
|
|
92
|
+
);
|
|
85
93
|
return { ...data ?? { drop: null, claimed: null, balance: null }, error, mutate };
|
|
86
94
|
}
|
|
87
95
|
// Annotate the CommonJS export names for ESM import in node:
|
|
88
96
|
0 && (module.exports = {
|
|
97
|
+
readDropState,
|
|
89
98
|
useDrop,
|
|
90
99
|
useDropChain,
|
|
91
100
|
useDropFee,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/use-drops.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type
|
|
1
|
+
{"version":3,"sources":["../../src/utils/use-drops.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport { normalizeAddress, type ApiDrop, type ApiDropListStatus, type ApiDropMint } from \"@medialane/sdk\";\nimport { dropClaimedBy, erc20Balance, type DropOnchain, type MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useMedialaneClient } from \"./use-medialane-client.js\";\n\nconst quiet = { revalidateOnFocus: false, shouldRetryOnError: false } as const;\n\nexport function useDrops(getClient: () => MedialaneClient, status: ApiDropListStatus) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading } = useSWR([\"drops\", status], () => client.api.getDrops({ status, limit: 48 }), quiet);\n return { drops: data?.data ?? ([] as ApiDrop[]), isLoading, error };\n}\n\nexport function useMyDrops(getClient: () => MedialaneClient, organizer: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading } = useSWR(organizer ? [\"my-drops\", organizer] : null, () => client.api.getDrops({ organizer: organizer!, limit: 100 }), quiet);\n return { drops: data?.data ?? ([] as ApiDrop[]), isLoading, error };\n}\n\nexport function useDrop(getClient: () => MedialaneClient, contract: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading, mutate } = useSWR(contract ? [\"drop\", contract] : null, () => client.api.getDrop(contract!), { ...quiet, refreshInterval: 30_000 });\n return { drop: data ?? null, isLoading, error, mutate };\n}\n\nexport function useDropMints(getClient: () => MedialaneClient, contract: string | null) {\n const client = useMedialaneClient(getClient);\n const { data, isLoading, mutate } = useSWR(contract ? [\"drop-mints\", contract] : null, () => client.api.getDropMints(contract!, { limit: 20 }), { ...quiet, refreshInterval: 30_000 });\n return { mints: data?.data ?? ([] as ApiDropMint[]), isLoading, mutate };\n}\n\n/** The platform fee, in basis points, the backend adds to a mint for this app; null until known. */\nexport function useDropFee(getClient: () => MedialaneClient): number | null {\n const client = useMedialaneClient(getClient);\n const { data } = useSWR(\"drop-fee\", () => client.api.getDropFee(), { revalidateOnFocus: false });\n return data?.launchpadBps ?? null;\n}\n\n/** A file from the drop's metadata folder (\"1\" or \"collection.json\"). */\nexport function useDropFile<T = Record<string, unknown>>(getClient: () => MedialaneClient, baseUri: string | null, name: string) {\n const client = useMedialaneClient(getClient);\n const { data } = useSWR(baseUri ? [\"drop-file\", baseUri, name] : null, async () => (await client.api.resolveMetadata(`${baseUri}${name}`)).data as T, quiet);\n return data ?? null;\n}\n\nexport interface DropChainState {\n drop: DropOnchain | null;\n claimed: bigint | null;\n balance: bigint | null;\n}\n\nexport async function readDropState(\n client: MedialaneClient,\n contract: string,\n wallet: string | null,\n): Promise<DropChainState> {\n const drop = await client.api.getDropState(contract);\n if (!drop) throw new Error(\"Drop not found\");\n const [claimed, balance] = await Promise.all([\n wallet ? dropClaimedBy(client.provider, contract, wallet) : Promise.resolve(null),\n wallet && drop.price > 0n ? erc20Balance(client.provider, normalizeAddress(\"STARKNET\", drop.paymentToken), normalizeAddress(\"STARKNET\", wallet)) : Promise.resolve(null),\n ]);\n return { drop, claimed, balance };\n}\n\nexport function useDropChain(\n getClient: () => MedialaneClient,\n contract: string | null,\n wallet: string | null,\n) {\n const client = useMedialaneClient(getClient);\n const { data, mutate, error } = useSWR(\n contract ? [\"drop-chain\", contract, wallet] : null,\n () => readDropState(client, contract!, wallet),\n { revalidateOnFocus: true, refreshInterval: 15_000 },\n );\n return { ...(data ?? { drop: null, claimed: null, balance: null }), error, mutate };\n}\n"],"mappings":"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","names":["useSWR"]}
|