@medialane/ui 0.185.0 → 0.187.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/fast-mint/fast-mint.d.cts +2 -2
- package/dist/components/fast-mint/fast-mint.d.ts +2 -2
- package/dist/components/media-wallet/action-button.cjs +54 -0
- package/dist/components/media-wallet/action-button.cjs.map +1 -0
- package/dist/components/media-wallet/action-button.d.cts +10 -0
- package/dist/components/media-wallet/action-button.d.ts +10 -0
- package/dist/components/media-wallet/action-button.js +28 -0
- package/dist/components/media-wallet/action-button.js.map +1 -0
- package/dist/components/media-wallet/action-modal.cjs +84 -0
- package/dist/components/media-wallet/action-modal.cjs.map +1 -0
- package/dist/components/media-wallet/action-modal.d.cts +20 -0
- package/dist/components/media-wallet/action-modal.d.ts +20 -0
- package/dist/components/media-wallet/action-modal.js +56 -0
- package/dist/components/media-wallet/action-modal.js.map +1 -0
- package/dist/components/media-wallet/activate-card.cjs +72 -0
- package/dist/components/media-wallet/activate-card.cjs.map +1 -0
- package/dist/components/media-wallet/activate-card.d.cts +7 -0
- package/dist/components/media-wallet/activate-card.d.ts +7 -0
- package/dist/components/media-wallet/activate-card.js +48 -0
- package/dist/components/media-wallet/activate-card.js.map +1 -0
- package/dist/components/media-wallet/address-qr.cjs +64 -0
- package/dist/components/media-wallet/address-qr.cjs.map +1 -0
- package/dist/components/media-wallet/address-qr.d.cts +8 -0
- package/dist/components/media-wallet/address-qr.d.ts +8 -0
- package/dist/components/media-wallet/address-qr.js +30 -0
- package/dist/components/media-wallet/address-qr.js.map +1 -0
- package/dist/components/media-wallet/back-button.cjs +41 -0
- package/dist/components/media-wallet/back-button.cjs.map +1 -0
- package/dist/components/media-wallet/back-button.d.cts +7 -0
- package/dist/components/media-wallet/back-button.d.ts +7 -0
- package/dist/components/media-wallet/back-button.js +17 -0
- package/dist/components/media-wallet/back-button.js.map +1 -0
- package/dist/components/media-wallet/copy-icon.cjs +49 -0
- package/dist/components/media-wallet/copy-icon.cjs.map +1 -0
- package/dist/components/media-wallet/copy-icon.d.cts +7 -0
- package/dist/components/media-wallet/copy-icon.d.ts +7 -0
- package/dist/components/media-wallet/copy-icon.js +25 -0
- package/dist/components/media-wallet/copy-icon.js.map +1 -0
- package/dist/components/media-wallet/currency-sheet.cjs +54 -0
- package/dist/components/media-wallet/currency-sheet.cjs.map +1 -0
- package/dist/components/media-wallet/currency-sheet.d.cts +12 -0
- package/dist/components/media-wallet/currency-sheet.d.ts +12 -0
- package/dist/components/media-wallet/currency-sheet.js +30 -0
- package/dist/components/media-wallet/currency-sheet.js.map +1 -0
- package/dist/components/media-wallet/media-wallet-activity.cjs +223 -0
- package/dist/components/media-wallet/media-wallet-activity.cjs.map +1 -0
- package/dist/components/media-wallet/media-wallet-activity.d.cts +12 -0
- package/dist/components/media-wallet/media-wallet-activity.d.ts +12 -0
- package/dist/components/media-wallet/media-wallet-activity.js +189 -0
- package/dist/components/media-wallet/media-wallet-activity.js.map +1 -0
- package/dist/components/media-wallet/media-wallet-header.cjs +97 -0
- package/dist/components/media-wallet/media-wallet-header.cjs.map +1 -0
- package/dist/components/media-wallet/media-wallet-header.d.cts +8 -0
- package/dist/components/media-wallet/media-wallet-header.d.ts +8 -0
- package/dist/components/media-wallet/media-wallet-header.js +63 -0
- package/dist/components/media-wallet/media-wallet-header.js.map +1 -0
- package/dist/components/media-wallet/media-wallet-home.cjs +258 -0
- package/dist/components/media-wallet/media-wallet-home.cjs.map +1 -0
- package/dist/components/media-wallet/media-wallet-home.d.cts +14 -0
- package/dist/components/media-wallet/media-wallet-home.d.ts +14 -0
- package/dist/components/media-wallet/media-wallet-home.js +224 -0
- package/dist/components/media-wallet/media-wallet-home.js.map +1 -0
- package/dist/components/media-wallet/media-wallet-overlay.cjs +137 -0
- package/dist/components/media-wallet/media-wallet-overlay.cjs.map +1 -0
- package/dist/components/media-wallet/media-wallet-overlay.d.cts +14 -0
- package/dist/components/media-wallet/media-wallet-overlay.d.ts +14 -0
- package/dist/components/media-wallet/media-wallet-overlay.js +102 -0
- package/dist/components/media-wallet/media-wallet-overlay.js.map +1 -0
- package/dist/components/media-wallet/media-wallet-send.cjs +313 -0
- package/dist/components/media-wallet/media-wallet-send.cjs.map +1 -0
- package/dist/components/media-wallet/media-wallet-send.d.cts +14 -0
- package/dist/components/media-wallet/media-wallet-send.d.ts +14 -0
- package/dist/components/media-wallet/media-wallet-send.js +289 -0
- package/dist/components/media-wallet/media-wallet-send.js.map +1 -0
- package/dist/components/media-wallet/media-wallet-token-detail.cjs +164 -0
- package/dist/components/media-wallet/media-wallet-token-detail.cjs.map +1 -0
- package/dist/components/media-wallet/media-wallet-token-detail.d.cts +13 -0
- package/dist/components/media-wallet/media-wallet-token-detail.d.ts +13 -0
- package/dist/components/media-wallet/media-wallet-token-detail.js +140 -0
- package/dist/components/media-wallet/media-wallet-token-detail.js.map +1 -0
- package/dist/components/media-wallet/media-wallet.cjs +51 -0
- package/dist/components/media-wallet/media-wallet.cjs.map +1 -0
- package/dist/components/media-wallet/media-wallet.d.cts +13 -0
- package/dist/components/media-wallet/media-wallet.d.ts +13 -0
- package/dist/components/media-wallet/media-wallet.js +27 -0
- package/dist/components/media-wallet/media-wallet.js.map +1 -0
- package/dist/components/media-wallet/nft-strip.cjs +85 -0
- package/dist/components/media-wallet/nft-strip.cjs.map +1 -0
- package/dist/components/media-wallet/nft-strip.d.cts +12 -0
- package/dist/components/media-wallet/nft-strip.d.ts +12 -0
- package/dist/components/media-wallet/nft-strip.js +51 -0
- package/dist/components/media-wallet/nft-strip.js.map +1 -0
- package/dist/components/media-wallet/quick-action.cjs +59 -0
- package/dist/components/media-wallet/quick-action.cjs.map +1 -0
- package/dist/components/media-wallet/quick-action.d.cts +12 -0
- package/dist/components/media-wallet/quick-action.d.ts +12 -0
- package/dist/components/media-wallet/quick-action.js +35 -0
- package/dist/components/media-wallet/quick-action.js.map +1 -0
- package/dist/components/media-wallet/receive-card.cjs +86 -0
- package/dist/components/media-wallet/receive-card.cjs.map +1 -0
- package/dist/components/media-wallet/receive-card.d.cts +7 -0
- package/dist/components/media-wallet/receive-card.d.ts +7 -0
- package/dist/components/media-wallet/receive-card.js +52 -0
- package/dist/components/media-wallet/receive-card.js.map +1 -0
- package/dist/components/media-wallet/section-header.cjs +32 -0
- package/dist/components/media-wallet/section-header.cjs.map +1 -0
- package/dist/components/media-wallet/section-header.d.cts +7 -0
- package/dist/components/media-wallet/section-header.d.ts +7 -0
- package/dist/components/media-wallet/section-header.js +8 -0
- package/dist/components/media-wallet/section-header.js.map +1 -0
- package/dist/components/media-wallet/success-dialog.cjs +75 -0
- package/dist/components/media-wallet/success-dialog.cjs.map +1 -0
- package/dist/components/media-wallet/success-dialog.d.cts +11 -0
- package/dist/components/media-wallet/success-dialog.d.ts +11 -0
- package/dist/components/media-wallet/success-dialog.js +51 -0
- package/dist/components/media-wallet/success-dialog.js.map +1 -0
- package/dist/components/media-wallet/types.cjs +37 -0
- package/dist/components/media-wallet/types.cjs.map +1 -0
- package/dist/components/media-wallet/types.d.cts +66 -0
- package/dist/components/media-wallet/types.d.ts +66 -0
- package/dist/components/media-wallet/types.js +12 -0
- package/dist/components/media-wallet/types.js.map +1 -0
- package/dist/components/media-wallet/wallet-activity-icon.cjs +69 -0
- package/dist/components/media-wallet/wallet-activity-icon.cjs.map +1 -0
- package/dist/components/media-wallet/wallet-activity-icon.d.cts +8 -0
- package/dist/components/media-wallet/wallet-activity-icon.d.ts +8 -0
- package/dist/components/media-wallet/wallet-activity-icon.js +45 -0
- package/dist/components/media-wallet/wallet-activity-icon.js.map +1 -0
- package/dist/components/sheet.d.cts +1 -1
- package/dist/components/sheet.d.ts +1 -1
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/app-wallet.cjs +10 -3
- package/dist/utils/app-wallet.cjs.map +1 -1
- package/dist/utils/app-wallet.d.cts +6 -1
- package/dist/utils/app-wallet.d.ts +6 -1
- package/dist/utils/app-wallet.js +9 -3
- package/dist/utils/app-wallet.js.map +1 -1
- package/dist/utils/media-wallet/activity-feed.cjs +35 -0
- package/dist/utils/media-wallet/activity-feed.cjs.map +1 -0
- package/dist/utils/media-wallet/activity-feed.d.cts +14 -0
- package/dist/utils/media-wallet/activity-feed.d.ts +14 -0
- package/dist/utils/media-wallet/activity-feed.js +11 -0
- package/dist/utils/media-wallet/activity-feed.js.map +1 -0
- package/dist/utils/media-wallet/confetti.cjs +51 -0
- package/dist/utils/media-wallet/confetti.cjs.map +1 -0
- package/dist/utils/media-wallet/confetti.d.cts +3 -0
- package/dist/utils/media-wallet/confetti.d.ts +3 -0
- package/dist/utils/media-wallet/confetti.js +17 -0
- package/dist/utils/media-wallet/confetti.js.map +1 -0
- package/dist/utils/media-wallet/nft-items.cjs +38 -0
- package/dist/utils/media-wallet/nft-items.cjs.map +1 -0
- package/dist/utils/media-wallet/nft-items.d.cts +13 -0
- package/dist/utils/media-wallet/nft-items.d.ts +13 -0
- package/dist/utils/media-wallet/nft-items.js +14 -0
- package/dist/utils/media-wallet/nft-items.js.map +1 -0
- package/dist/utils/media-wallet/run-intent-calls.cjs +32 -0
- package/dist/utils/media-wallet/run-intent-calls.cjs.map +1 -0
- package/dist/utils/media-wallet/run-intent-calls.d.cts +16 -0
- package/dist/utils/media-wallet/run-intent-calls.d.ts +16 -0
- package/dist/utils/media-wallet/run-intent-calls.js +8 -0
- package/dist/utils/media-wallet/run-intent-calls.js.map +1 -0
- package/dist/utils/media-wallet/use-erc20-balance.cjs +75 -0
- package/dist/utils/media-wallet/use-erc20-balance.cjs.map +1 -0
- package/dist/utils/media-wallet/use-erc20-balance.d.cts +15 -0
- package/dist/utils/media-wallet/use-erc20-balance.d.ts +15 -0
- package/dist/utils/media-wallet/use-erc20-balance.js +40 -0
- package/dist/utils/media-wallet/use-erc20-balance.js.map +1 -0
- package/dist/utils/media-wallet/use-tokens-by-owner.cjs +52 -0
- package/dist/utils/media-wallet/use-tokens-by-owner.cjs.map +1 -0
- package/dist/utils/media-wallet/use-tokens-by-owner.d.cts +10 -0
- package/dist/utils/media-wallet/use-tokens-by-owner.d.ts +10 -0
- package/dist/utils/media-wallet/use-tokens-by-owner.js +18 -0
- package/dist/utils/media-wallet/use-tokens-by-owner.js.map +1 -0
- package/dist/utils/media-wallet/wallet-activity.cjs +83 -0
- package/dist/utils/media-wallet/wallet-activity.cjs.map +1 -0
- package/dist/utils/media-wallet/wallet-activity.d.cts +7 -0
- package/dist/utils/media-wallet/wallet-activity.d.ts +7 -0
- package/dist/utils/media-wallet/wallet-activity.js +57 -0
- package/dist/utils/media-wallet/wallet-activity.js.map +1 -0
- package/dist/utils/media-wallet/wallet-format.cjs +59 -0
- package/dist/utils/media-wallet/wallet-format.cjs.map +1 -0
- package/dist/utils/media-wallet/wallet-format.d.cts +9 -0
- package/dist/utils/media-wallet/wallet-format.d.ts +9 -0
- package/dist/utils/media-wallet/wallet-format.js +29 -0
- package/dist/utils/media-wallet/wallet-format.js.map +1 -0
- package/dist/utils/media-wallet/wallet-tokens.cjs +39 -0
- package/dist/utils/media-wallet/wallet-tokens.cjs.map +1 -0
- package/dist/utils/media-wallet/wallet-tokens.d.cts +10 -0
- package/dist/utils/media-wallet/wallet-tokens.d.ts +10 -0
- package/dist/utils/media-wallet/wallet-tokens.js +15 -0
- package/dist/utils/media-wallet/wallet-tokens.js.map +1 -0
- package/package.json +11 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/nft-items.ts"],"sourcesContent":["import type { ApiToken } from \"@medialane/sdk\";\n\nexport interface NftItem {\n key: string;\n href: string;\n name: string;\n image: string | null;\n ipType: string | null;\n fallbackId: string;\n}\n\nexport function pickNftItems(tokens: ApiToken[], limit: number): NftItem[] {\n return tokens.slice(0, limit).map((token) => ({\n key: `${token.contractAddress}-${token.tokenId}`,\n href: `/asset/starknet/${token.contractAddress}/${token.tokenId}`,\n name: token.metadata.name ?? `#${token.tokenId}`,\n image: token.metadata.image,\n ipType: token.metadata.ipType,\n fallbackId: token.tokenId,\n }));\n}\n"],"mappings":"AAWO,SAAS,aAAa,QAAoB,OAA0B;AACzE,SAAO,OAAO,MAAM,GAAG,KAAK,EAAE,IAAI,CAAC,WAAW;AAAA,IAC5C,KAAK,GAAG,MAAM,eAAe,IAAI,MAAM,OAAO;AAAA,IAC9C,MAAM,mBAAmB,MAAM,eAAe,IAAI,MAAM,OAAO;AAAA,IAC/D,MAAM,MAAM,SAAS,QAAQ,IAAI,MAAM,OAAO;AAAA,IAC9C,OAAO,MAAM,SAAS;AAAA,IACtB,QAAQ,MAAM,SAAS;AAAA,IACvB,YAAY,MAAM;AAAA,EACpB,EAAE;AACJ;","names":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var run_intent_calls_exports = {};
|
|
20
|
+
__export(run_intent_calls_exports, {
|
|
21
|
+
runIntentCalls: () => runIntentCalls
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(run_intent_calls_exports);
|
|
24
|
+
async function runIntentCalls(signer, create) {
|
|
25
|
+
const intent = (await create()).data;
|
|
26
|
+
return signer.execute(intent.calls, { intentIds: [intent.id] });
|
|
27
|
+
}
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
runIntentCalls
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=run-intent-calls.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/run-intent-calls.ts"],"sourcesContent":["import type { Call } from \"starknet\";\nimport type { ApiIntentCreated } from \"@medialane/sdk\";\n\nexport async function runIntentCalls(\n signer: { execute(calls: Call[], opts?: { intentIds?: string[] }): Promise<{ txHash: string }> },\n create: () => Promise<{ data: ApiIntentCreated }>,\n): Promise<{ txHash: string }> {\n const intent = (await create()).data as { id: string; calls: Call[] };\n return signer.execute(intent.calls, { intentIds: [intent.id] });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,eAAsB,eACpB,QACA,QAC6B;AAC7B,QAAM,UAAU,MAAM,OAAO,GAAG;AAChC,SAAO,OAAO,QAAQ,OAAO,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;AAChE;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Call } from 'starknet';
|
|
2
|
+
import { ApiIntentCreated } from '@medialane/sdk';
|
|
3
|
+
|
|
4
|
+
declare function runIntentCalls(signer: {
|
|
5
|
+
execute(calls: Call[], opts?: {
|
|
6
|
+
intentIds?: string[];
|
|
7
|
+
}): Promise<{
|
|
8
|
+
txHash: string;
|
|
9
|
+
}>;
|
|
10
|
+
}, create: () => Promise<{
|
|
11
|
+
data: ApiIntentCreated;
|
|
12
|
+
}>): Promise<{
|
|
13
|
+
txHash: string;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
export { runIntentCalls };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Call } from 'starknet';
|
|
2
|
+
import { ApiIntentCreated } from '@medialane/sdk';
|
|
3
|
+
|
|
4
|
+
declare function runIntentCalls(signer: {
|
|
5
|
+
execute(calls: Call[], opts?: {
|
|
6
|
+
intentIds?: string[];
|
|
7
|
+
}): Promise<{
|
|
8
|
+
txHash: string;
|
|
9
|
+
}>;
|
|
10
|
+
}, create: () => Promise<{
|
|
11
|
+
data: ApiIntentCreated;
|
|
12
|
+
}>): Promise<{
|
|
13
|
+
txHash: string;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
export { runIntentCalls };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/run-intent-calls.ts"],"sourcesContent":["import type { Call } from \"starknet\";\nimport type { ApiIntentCreated } from \"@medialane/sdk\";\n\nexport async function runIntentCalls(\n signer: { execute(calls: Call[], opts?: { intentIds?: string[] }): Promise<{ txHash: string }> },\n create: () => Promise<{ data: ApiIntentCreated }>,\n): Promise<{ txHash: string }> {\n const intent = (await create()).data as { id: string; calls: Call[] };\n return signer.execute(intent.calls, { intentIds: [intent.id] });\n}\n"],"mappings":"AAGA,eAAsB,eACpB,QACA,QAC6B;AAC7B,QAAM,UAAU,MAAM,OAAO,GAAG;AAChC,SAAO,OAAO,QAAQ,OAAO,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;AAChE;","names":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var use_erc20_balance_exports = {};
|
|
31
|
+
__export(use_erc20_balance_exports, {
|
|
32
|
+
useErc20Balance: () => useErc20Balance,
|
|
33
|
+
useTokenBalance: () => useTokenBalance
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(use_erc20_balance_exports);
|
|
36
|
+
var import_swr = __toESM(require("swr"), 1);
|
|
37
|
+
var import_sdk = require("@medialane/sdk");
|
|
38
|
+
async function fetchErc20Balance(provider, tokenAddress, holderAddress) {
|
|
39
|
+
const result = await provider.callContract(
|
|
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) {
|
|
52
|
+
const { data, error, isLoading } = (0, import_swr.default)(
|
|
53
|
+
tokenAddress && holderAddress ? ["erc20-balance", tokenAddress, holderAddress] : null,
|
|
54
|
+
([, addr, holder]) => fetchErc20Balance(provider, addr, holder),
|
|
55
|
+
{
|
|
56
|
+
refreshInterval: 3e4,
|
|
57
|
+
revalidateOnFocus: false,
|
|
58
|
+
shouldRetryOnError: false,
|
|
59
|
+
onError: () => {
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
return { rawBalance: data ?? null, isLoading, error };
|
|
64
|
+
}
|
|
65
|
+
function useTokenBalance(provider, symbol, holderAddress) {
|
|
66
|
+
const token = symbol ? (0, import_sdk.getListableTokens)().find((t) => t.symbol === symbol) ?? null : null;
|
|
67
|
+
const { rawBalance, isLoading, error } = useErc20Balance(provider, token?.address ?? null, holderAddress);
|
|
68
|
+
return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };
|
|
69
|
+
}
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
useErc20Balance,
|
|
73
|
+
useTokenBalance
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=use-erc20-balance.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/use-erc20-balance.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ProviderInterface } from \"starknet\";\nimport { getListableTokens } from \"@medialane/sdk\";\n\nasync function fetchErc20Balance(provider: ProviderInterface, tokenAddress: string, holderAddress: string): Promise<bigint> {\n const result = await provider.callContract(\n {\n contractAddress: tokenAddress,\n entrypoint: \"balanceOf\",\n calldata: [holderAddress],\n },\n \"latest\"\n );\n\n const low = BigInt(result[0]);\n const high = BigInt(result[1]);\n return low + (high << 128n);\n}\n\nexport function useErc20Balance(provider: ProviderInterface, tokenAddress: string | null, holderAddress: string | null) {\n const { data, error, isLoading } = useSWR(\n tokenAddress && holderAddress ? [\"erc20-balance\", tokenAddress, holderAddress] : null,\n ([, addr, holder]) => fetchErc20Balance(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(provider: ProviderInterface, symbol: string | null, holderAddress: string | null) {\n const token = symbol ? getListableTokens().find((t) => t.symbol === symbol) ?? null : null;\n const { rawBalance, isLoading, error } = useErc20Balance(provider, token?.address ?? null, holderAddress);\n return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAEnB,iBAAkC;AAElC,eAAe,kBAAkB,UAA6B,cAAsB,eAAwC;AAC1H,QAAM,SAAS,MAAM,SAAS;AAAA,IAC5B;AAAA,MACE,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,UAAU,CAAC,aAAa;AAAA,IAC1B;AAAA,IACA;AAAA,EACF;AAEA,QAAM,MAAM,OAAO,OAAO,CAAC,CAAC;AAC5B,QAAM,OAAO,OAAO,OAAO,CAAC,CAAC;AAC7B,SAAO,OAAO,QAAQ;AACxB;AAEO,SAAS,gBAAgB,UAA6B,cAA6B,eAA8B;AACtH,QAAM,EAAE,MAAM,OAAO,UAAU,QAAI,WAAAA;AAAA,IACjC,gBAAgB,gBAAgB,CAAC,iBAAiB,cAAc,aAAa,IAAI;AAAA,IACjF,CAAC,CAAC,EAAE,MAAM,MAAM,MAAM,kBAAkB,UAAU,MAAM,MAAM;AAAA,IAC9D;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,UAA6B,QAAuB,eAA8B;AAChH,QAAM,QAAQ,aAAS,8BAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,MAAM,KAAK,OAAO;AACtF,QAAM,EAAE,YAAY,WAAW,MAAM,IAAI,gBAAgB,UAAU,OAAO,WAAW,MAAM,aAAa;AACxG,SAAO,EAAE,YAAY,WAAW,OAAO,UAAU,OAAO,YAAY,GAAG;AACzE;","names":["useSWR"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ProviderInterface } from 'starknet';
|
|
2
|
+
|
|
3
|
+
declare function useErc20Balance(provider: ProviderInterface, tokenAddress: string | null, holderAddress: string | null): {
|
|
4
|
+
rawBalance: bigint | null;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
error: any;
|
|
7
|
+
};
|
|
8
|
+
declare function useTokenBalance(provider: ProviderInterface, symbol: string | null, holderAddress: string | null): {
|
|
9
|
+
rawBalance: bigint | null;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
error: any;
|
|
12
|
+
decimals: 6 | 18 | 8;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { useErc20Balance, useTokenBalance };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ProviderInterface } from 'starknet';
|
|
2
|
+
|
|
3
|
+
declare function useErc20Balance(provider: ProviderInterface, tokenAddress: string | null, holderAddress: string | null): {
|
|
4
|
+
rawBalance: bigint | null;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
error: any;
|
|
7
|
+
};
|
|
8
|
+
declare function useTokenBalance(provider: ProviderInterface, symbol: string | null, holderAddress: string | null): {
|
|
9
|
+
rawBalance: bigint | null;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
error: any;
|
|
12
|
+
decimals: 6 | 18 | 8;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { useErc20Balance, useTokenBalance };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import useSWR from "swr";
|
|
3
|
+
import { getListableTokens } from "@medialane/sdk";
|
|
4
|
+
async function fetchErc20Balance(provider, tokenAddress, holderAddress) {
|
|
5
|
+
const result = await provider.callContract(
|
|
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) {
|
|
18
|
+
const { data, error, isLoading } = useSWR(
|
|
19
|
+
tokenAddress && holderAddress ? ["erc20-balance", tokenAddress, holderAddress] : null,
|
|
20
|
+
([, addr, holder]) => fetchErc20Balance(provider, addr, holder),
|
|
21
|
+
{
|
|
22
|
+
refreshInterval: 3e4,
|
|
23
|
+
revalidateOnFocus: false,
|
|
24
|
+
shouldRetryOnError: false,
|
|
25
|
+
onError: () => {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
return { rawBalance: data ?? null, isLoading, error };
|
|
30
|
+
}
|
|
31
|
+
function useTokenBalance(provider, symbol, holderAddress) {
|
|
32
|
+
const token = symbol ? getListableTokens().find((t) => t.symbol === symbol) ?? null : null;
|
|
33
|
+
const { rawBalance, isLoading, error } = useErc20Balance(provider, token?.address ?? null, holderAddress);
|
|
34
|
+
return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
useErc20Balance,
|
|
38
|
+
useTokenBalance
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=use-erc20-balance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/use-erc20-balance.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ProviderInterface } from \"starknet\";\nimport { getListableTokens } from \"@medialane/sdk\";\n\nasync function fetchErc20Balance(provider: ProviderInterface, tokenAddress: string, holderAddress: string): Promise<bigint> {\n const result = await provider.callContract(\n {\n contractAddress: tokenAddress,\n entrypoint: \"balanceOf\",\n calldata: [holderAddress],\n },\n \"latest\"\n );\n\n const low = BigInt(result[0]);\n const high = BigInt(result[1]);\n return low + (high << 128n);\n}\n\nexport function useErc20Balance(provider: ProviderInterface, tokenAddress: string | null, holderAddress: string | null) {\n const { data, error, isLoading } = useSWR(\n tokenAddress && holderAddress ? [\"erc20-balance\", tokenAddress, holderAddress] : null,\n ([, addr, holder]) => fetchErc20Balance(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(provider: ProviderInterface, symbol: string | null, holderAddress: string | null) {\n const token = symbol ? getListableTokens().find((t) => t.symbol === symbol) ?? null : null;\n const { rawBalance, isLoading, error } = useErc20Balance(provider, token?.address ?? null, holderAddress);\n return { rawBalance, isLoading, error, decimals: token?.decimals ?? 18 };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAEnB,SAAS,yBAAyB;AAElC,eAAe,kBAAkB,UAA6B,cAAsB,eAAwC;AAC1H,QAAM,SAAS,MAAM,SAAS;AAAA,IAC5B;AAAA,MACE,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,UAAU,CAAC,aAAa;AAAA,IAC1B;AAAA,IACA;AAAA,EACF;AAEA,QAAM,MAAM,OAAO,OAAO,CAAC,CAAC;AAC5B,QAAM,OAAO,OAAO,OAAO,CAAC,CAAC;AAC7B,SAAO,OAAO,QAAQ;AACxB;AAEO,SAAS,gBAAgB,UAA6B,cAA6B,eAA8B;AACtH,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI;AAAA,IACjC,gBAAgB,gBAAgB,CAAC,iBAAiB,cAAc,aAAa,IAAI;AAAA,IACjF,CAAC,CAAC,EAAE,MAAM,MAAM,MAAM,kBAAkB,UAAU,MAAM,MAAM;AAAA,IAC9D;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,UAA6B,QAAuB,eAA8B;AAChH,QAAM,QAAQ,SAAS,kBAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,MAAM,KAAK,OAAO;AACtF,QAAM,EAAE,YAAY,WAAW,MAAM,IAAI,gBAAgB,UAAU,OAAO,WAAW,MAAM,aAAa;AACxG,SAAO,EAAE,YAAY,WAAW,OAAO,UAAU,OAAO,YAAY,GAAG;AACzE;","names":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var use_tokens_by_owner_exports = {};
|
|
31
|
+
__export(use_tokens_by_owner_exports, {
|
|
32
|
+
useTokensByOwner: () => useTokensByOwner
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(use_tokens_by_owner_exports);
|
|
35
|
+
var import_swr = __toESM(require("swr"), 1);
|
|
36
|
+
var import_query_keys = require("../query-keys.js");
|
|
37
|
+
var import_use_medialane_client = require("../use-medialane-client.js");
|
|
38
|
+
const EMPTY_TOKENS = [];
|
|
39
|
+
function useTokensByOwner(getClient, address, page = 1, limit = 20) {
|
|
40
|
+
const client = (0, import_use_medialane_client.useMedialaneClient)(getClient);
|
|
41
|
+
const { data, error, isLoading } = (0, import_swr.default)(
|
|
42
|
+
address ? import_query_keys.queryKeys.tokensOwned(address, page, limit) : null,
|
|
43
|
+
() => client.api.getTokensByOwner(address, page, limit),
|
|
44
|
+
{ revalidateOnFocus: false, refreshInterval: 6e4, revalidateOnMount: true }
|
|
45
|
+
);
|
|
46
|
+
return { tokens: data?.data ?? EMPTY_TOKENS, isLoading, error };
|
|
47
|
+
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
useTokensByOwner
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=use-tokens-by-owner.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/use-tokens-by-owner.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { queryKeys } from \"../query-keys.js\";\nimport { useMedialaneClient } from \"../use-medialane-client.js\";\n\nconst EMPTY_TOKENS: ApiToken[] = [];\n\nexport function useTokensByOwner(getClient: () => MedialaneClient, address: string | null, page = 1, limit = 20) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading } = useSWR(\n address ? queryKeys.tokensOwned(address, page, limit) : null,\n () => client.api.getTokensByOwner(address!, page, limit),\n { revalidateOnFocus: false, refreshInterval: 60_000, revalidateOnMount: true }\n );\n return { tokens: data?.data ?? EMPTY_TOKENS, isLoading, error };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAGnB,wBAA0B;AAC1B,kCAAmC;AAEnC,MAAM,eAA2B,CAAC;AAE3B,SAAS,iBAAiB,WAAkC,SAAwB,OAAO,GAAG,QAAQ,IAAI;AAC/G,QAAM,aAAS,gDAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,UAAU,QAAI,WAAAA;AAAA,IACjC,UAAU,4BAAU,YAAY,SAAS,MAAM,KAAK,IAAI;AAAA,IACxD,MAAM,OAAO,IAAI,iBAAiB,SAAU,MAAM,KAAK;AAAA,IACvD,EAAE,mBAAmB,OAAO,iBAAiB,KAAQ,mBAAmB,KAAK;AAAA,EAC/E;AACA,SAAO,EAAE,QAAQ,MAAM,QAAQ,cAAc,WAAW,MAAM;AAChE;","names":["useSWR"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ApiToken } from '@medialane/sdk';
|
|
2
|
+
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
|
+
|
|
4
|
+
declare function useTokensByOwner(getClient: () => MedialaneClient, address: string | null, page?: number, limit?: number): {
|
|
5
|
+
tokens: ApiToken[];
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
error: any;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { useTokensByOwner };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ApiToken } from '@medialane/sdk';
|
|
2
|
+
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
|
+
|
|
4
|
+
declare function useTokensByOwner(getClient: () => MedialaneClient, address: string | null, page?: number, limit?: number): {
|
|
5
|
+
tokens: ApiToken[];
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
error: any;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { useTokensByOwner };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import useSWR from "swr";
|
|
3
|
+
import { queryKeys } from "../query-keys.js";
|
|
4
|
+
import { useMedialaneClient } from "../use-medialane-client.js";
|
|
5
|
+
const EMPTY_TOKENS = [];
|
|
6
|
+
function useTokensByOwner(getClient, address, page = 1, limit = 20) {
|
|
7
|
+
const client = useMedialaneClient(getClient);
|
|
8
|
+
const { data, error, isLoading } = useSWR(
|
|
9
|
+
address ? queryKeys.tokensOwned(address, page, limit) : null,
|
|
10
|
+
() => client.api.getTokensByOwner(address, page, limit),
|
|
11
|
+
{ revalidateOnFocus: false, refreshInterval: 6e4, revalidateOnMount: true }
|
|
12
|
+
);
|
|
13
|
+
return { tokens: data?.data ?? EMPTY_TOKENS, isLoading, error };
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
useTokensByOwner
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=use-tokens-by-owner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/use-tokens-by-owner.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\nimport type { ApiToken } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { queryKeys } from \"../query-keys.js\";\nimport { useMedialaneClient } from \"../use-medialane-client.js\";\n\nconst EMPTY_TOKENS: ApiToken[] = [];\n\nexport function useTokensByOwner(getClient: () => MedialaneClient, address: string | null, page = 1, limit = 20) {\n const client = useMedialaneClient(getClient);\n const { data, error, isLoading } = useSWR(\n address ? queryKeys.tokensOwned(address, page, limit) : null,\n () => client.api.getTokensByOwner(address!, page, limit),\n { revalidateOnFocus: false, refreshInterval: 60_000, revalidateOnMount: true }\n );\n return { tokens: data?.data ?? EMPTY_TOKENS, isLoading, error };\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAGnB,SAAS,iBAAiB;AAC1B,SAAS,0BAA0B;AAEnC,MAAM,eAA2B,CAAC;AAE3B,SAAS,iBAAiB,WAAkC,SAAwB,OAAO,GAAG,QAAQ,IAAI;AAC/G,QAAM,SAAS,mBAAmB,SAAS;AAC3C,QAAM,EAAE,MAAM,OAAO,UAAU,IAAI;AAAA,IACjC,UAAU,UAAU,YAAY,SAAS,MAAM,KAAK,IAAI;AAAA,IACxD,MAAM,OAAO,IAAI,iBAAiB,SAAU,MAAM,KAAK;AAAA,IACvD,EAAE,mBAAmB,OAAO,iBAAiB,KAAQ,mBAAmB,KAAK;AAAA,EAC/E;AACA,SAAO,EAAE,QAAQ,MAAM,QAAQ,cAAc,WAAW,MAAM;AAChE;","names":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var wallet_activity_exports = {};
|
|
20
|
+
__export(wallet_activity_exports, {
|
|
21
|
+
walletActivityAmount: () => walletActivityAmount,
|
|
22
|
+
walletActivitySubtitle: () => walletActivitySubtitle,
|
|
23
|
+
walletActivityTitle: () => walletActivityTitle
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(wallet_activity_exports);
|
|
26
|
+
var import_sdk = require("@medialane/sdk");
|
|
27
|
+
var import_wallet_format = require("./wallet-format.js");
|
|
28
|
+
function tokenAmount(tokenAddress, amount) {
|
|
29
|
+
if (!amount) return null;
|
|
30
|
+
const token = tokenAddress ? (0, import_sdk.getTokenByAddress)(tokenAddress) : void 0;
|
|
31
|
+
if (!token) return amount;
|
|
32
|
+
return `${(0, import_wallet_format.fmt)(BigInt(amount), token.decimals)} ${token.symbol}`;
|
|
33
|
+
}
|
|
34
|
+
function walletActivityTitle(a) {
|
|
35
|
+
switch (a.type) {
|
|
36
|
+
case "SEND":
|
|
37
|
+
return "Sent";
|
|
38
|
+
case "RECEIVE":
|
|
39
|
+
return "Received";
|
|
40
|
+
case "SWAP":
|
|
41
|
+
return "Swapped";
|
|
42
|
+
case "DEPLOY":
|
|
43
|
+
return "Account activated";
|
|
44
|
+
case "GUARDIAN_SET":
|
|
45
|
+
return "Guardian added";
|
|
46
|
+
case "GUARDIAN_TRIGGER_ESCAPE":
|
|
47
|
+
return "Recovery started";
|
|
48
|
+
case "GUARDIAN_COMPLETE_ESCAPE":
|
|
49
|
+
return "Recovery completed";
|
|
50
|
+
case "GUARDIAN_CANCEL_ESCAPE":
|
|
51
|
+
return "Recovery canceled";
|
|
52
|
+
default: {
|
|
53
|
+
const exhaustive = a.type;
|
|
54
|
+
throw new Error(`Unhandled WalletActivityType: ${exhaustive}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function walletActivitySubtitle(a) {
|
|
59
|
+
switch (a.type) {
|
|
60
|
+
case "SEND":
|
|
61
|
+
return a.counterparty ? `to ${(0, import_wallet_format.short)(a.counterparty)}` : null;
|
|
62
|
+
case "RECEIVE":
|
|
63
|
+
return a.counterparty ? `from ${(0, import_wallet_format.short)(a.counterparty)}` : null;
|
|
64
|
+
case "SWAP": {
|
|
65
|
+
const from = tokenAmount(a.tokenInAddress, a.amountIn);
|
|
66
|
+
const to = tokenAmount(a.tokenOutAddress, a.amountOut);
|
|
67
|
+
return from && to ? `${from} \u2192 ${to}` : null;
|
|
68
|
+
}
|
|
69
|
+
default:
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function walletActivityAmount(a) {
|
|
74
|
+
if (a.type === "SEND" || a.type === "RECEIVE") return tokenAmount(a.tokenAddress, a.amount);
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
walletActivityAmount,
|
|
80
|
+
walletActivitySubtitle,
|
|
81
|
+
walletActivityTitle
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=wallet-activity.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/wallet-activity.ts"],"sourcesContent":["import { getTokenByAddress } from \"@medialane/sdk\";\nimport type { ApiWalletActivity } from \"@medialane/sdk\";\nimport { fmt, short } from \"./wallet-format.js\";\n\nfunction tokenAmount(tokenAddress: string | null, amount: string | null): string | null {\n if (!amount) return null;\n const token = tokenAddress ? getTokenByAddress(tokenAddress) : undefined;\n if (!token) return amount;\n return `${fmt(BigInt(amount), token.decimals)} ${token.symbol}`;\n}\n\nexport function walletActivityTitle(a: ApiWalletActivity): string {\n switch (a.type) {\n case \"SEND\": return \"Sent\";\n case \"RECEIVE\": return \"Received\";\n case \"SWAP\": return \"Swapped\";\n case \"DEPLOY\": return \"Account activated\";\n case \"GUARDIAN_SET\": return \"Guardian added\";\n case \"GUARDIAN_TRIGGER_ESCAPE\": return \"Recovery started\";\n case \"GUARDIAN_COMPLETE_ESCAPE\": return \"Recovery completed\";\n case \"GUARDIAN_CANCEL_ESCAPE\": return \"Recovery canceled\";\n default: {\n const exhaustive: never = a.type;\n throw new Error(`Unhandled WalletActivityType: ${exhaustive}`);\n }\n }\n}\n\nexport function walletActivitySubtitle(a: ApiWalletActivity): string | null {\n switch (a.type) {\n case \"SEND\": return a.counterparty ? `to ${short(a.counterparty)}` : null;\n case \"RECEIVE\": return a.counterparty ? `from ${short(a.counterparty)}` : null;\n case \"SWAP\": {\n const from = tokenAmount(a.tokenInAddress, a.amountIn);\n const to = tokenAmount(a.tokenOutAddress, a.amountOut);\n return from && to ? `${from} → ${to}` : null;\n }\n default: return null;\n }\n}\n\nexport function walletActivityAmount(a: ApiWalletActivity): string | null {\n if (a.type === \"SEND\" || a.type === \"RECEIVE\") return tokenAmount(a.tokenAddress, a.amount);\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkC;AAElC,2BAA2B;AAE3B,SAAS,YAAY,cAA6B,QAAsC;AACtF,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,QAAQ,mBAAe,8BAAkB,YAAY,IAAI;AAC/D,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,OAAG,0BAAI,OAAO,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,MAAM,MAAM;AAC/D;AAEO,SAAS,oBAAoB,GAA8B;AAChE,UAAQ,EAAE,MAAM;AAAA,IACd,KAAK;AAAQ,aAAO;AAAA,IACpB,KAAK;AAAW,aAAO;AAAA,IACvB,KAAK;AAAQ,aAAO;AAAA,IACpB,KAAK;AAAU,aAAO;AAAA,IACtB,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAA2B,aAAO;AAAA,IACvC,KAAK;AAA4B,aAAO;AAAA,IACxC,KAAK;AAA0B,aAAO;AAAA,IACtC,SAAS;AACP,YAAM,aAAoB,EAAE;AAC5B,YAAM,IAAI,MAAM,iCAAiC,UAAU,EAAE;AAAA,IAC/D;AAAA,EACF;AACF;AAEO,SAAS,uBAAuB,GAAqC;AAC1E,UAAQ,EAAE,MAAM;AAAA,IACd,KAAK;AAAQ,aAAO,EAAE,eAAe,UAAM,4BAAM,EAAE,YAAY,CAAC,KAAK;AAAA,IACrE,KAAK;AAAW,aAAO,EAAE,eAAe,YAAQ,4BAAM,EAAE,YAAY,CAAC,KAAK;AAAA,IAC1E,KAAK,QAAQ;AACX,YAAM,OAAO,YAAY,EAAE,gBAAgB,EAAE,QAAQ;AACrD,YAAM,KAAK,YAAY,EAAE,iBAAiB,EAAE,SAAS;AACrD,aAAO,QAAQ,KAAK,GAAG,IAAI,WAAM,EAAE,KAAK;AAAA,IAC1C;AAAA,IACA;AAAS,aAAO;AAAA,EAClB;AACF;AAEO,SAAS,qBAAqB,GAAqC;AACxE,MAAI,EAAE,SAAS,UAAU,EAAE,SAAS,UAAW,QAAO,YAAY,EAAE,cAAc,EAAE,MAAM;AAC1F,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ApiWalletActivity } from '@medialane/sdk';
|
|
2
|
+
|
|
3
|
+
declare function walletActivityTitle(a: ApiWalletActivity): string;
|
|
4
|
+
declare function walletActivitySubtitle(a: ApiWalletActivity): string | null;
|
|
5
|
+
declare function walletActivityAmount(a: ApiWalletActivity): string | null;
|
|
6
|
+
|
|
7
|
+
export { walletActivityAmount, walletActivitySubtitle, walletActivityTitle };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ApiWalletActivity } from '@medialane/sdk';
|
|
2
|
+
|
|
3
|
+
declare function walletActivityTitle(a: ApiWalletActivity): string;
|
|
4
|
+
declare function walletActivitySubtitle(a: ApiWalletActivity): string | null;
|
|
5
|
+
declare function walletActivityAmount(a: ApiWalletActivity): string | null;
|
|
6
|
+
|
|
7
|
+
export { walletActivityAmount, walletActivitySubtitle, walletActivityTitle };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { getTokenByAddress } from "@medialane/sdk";
|
|
2
|
+
import { fmt, short } from "./wallet-format.js";
|
|
3
|
+
function tokenAmount(tokenAddress, amount) {
|
|
4
|
+
if (!amount) return null;
|
|
5
|
+
const token = tokenAddress ? getTokenByAddress(tokenAddress) : void 0;
|
|
6
|
+
if (!token) return amount;
|
|
7
|
+
return `${fmt(BigInt(amount), token.decimals)} ${token.symbol}`;
|
|
8
|
+
}
|
|
9
|
+
function walletActivityTitle(a) {
|
|
10
|
+
switch (a.type) {
|
|
11
|
+
case "SEND":
|
|
12
|
+
return "Sent";
|
|
13
|
+
case "RECEIVE":
|
|
14
|
+
return "Received";
|
|
15
|
+
case "SWAP":
|
|
16
|
+
return "Swapped";
|
|
17
|
+
case "DEPLOY":
|
|
18
|
+
return "Account activated";
|
|
19
|
+
case "GUARDIAN_SET":
|
|
20
|
+
return "Guardian added";
|
|
21
|
+
case "GUARDIAN_TRIGGER_ESCAPE":
|
|
22
|
+
return "Recovery started";
|
|
23
|
+
case "GUARDIAN_COMPLETE_ESCAPE":
|
|
24
|
+
return "Recovery completed";
|
|
25
|
+
case "GUARDIAN_CANCEL_ESCAPE":
|
|
26
|
+
return "Recovery canceled";
|
|
27
|
+
default: {
|
|
28
|
+
const exhaustive = a.type;
|
|
29
|
+
throw new Error(`Unhandled WalletActivityType: ${exhaustive}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function walletActivitySubtitle(a) {
|
|
34
|
+
switch (a.type) {
|
|
35
|
+
case "SEND":
|
|
36
|
+
return a.counterparty ? `to ${short(a.counterparty)}` : null;
|
|
37
|
+
case "RECEIVE":
|
|
38
|
+
return a.counterparty ? `from ${short(a.counterparty)}` : null;
|
|
39
|
+
case "SWAP": {
|
|
40
|
+
const from = tokenAmount(a.tokenInAddress, a.amountIn);
|
|
41
|
+
const to = tokenAmount(a.tokenOutAddress, a.amountOut);
|
|
42
|
+
return from && to ? `${from} \u2192 ${to}` : null;
|
|
43
|
+
}
|
|
44
|
+
default:
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function walletActivityAmount(a) {
|
|
49
|
+
if (a.type === "SEND" || a.type === "RECEIVE") return tokenAmount(a.tokenAddress, a.amount);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
walletActivityAmount,
|
|
54
|
+
walletActivitySubtitle,
|
|
55
|
+
walletActivityTitle
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=wallet-activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/wallet-activity.ts"],"sourcesContent":["import { getTokenByAddress } from \"@medialane/sdk\";\nimport type { ApiWalletActivity } from \"@medialane/sdk\";\nimport { fmt, short } from \"./wallet-format.js\";\n\nfunction tokenAmount(tokenAddress: string | null, amount: string | null): string | null {\n if (!amount) return null;\n const token = tokenAddress ? getTokenByAddress(tokenAddress) : undefined;\n if (!token) return amount;\n return `${fmt(BigInt(amount), token.decimals)} ${token.symbol}`;\n}\n\nexport function walletActivityTitle(a: ApiWalletActivity): string {\n switch (a.type) {\n case \"SEND\": return \"Sent\";\n case \"RECEIVE\": return \"Received\";\n case \"SWAP\": return \"Swapped\";\n case \"DEPLOY\": return \"Account activated\";\n case \"GUARDIAN_SET\": return \"Guardian added\";\n case \"GUARDIAN_TRIGGER_ESCAPE\": return \"Recovery started\";\n case \"GUARDIAN_COMPLETE_ESCAPE\": return \"Recovery completed\";\n case \"GUARDIAN_CANCEL_ESCAPE\": return \"Recovery canceled\";\n default: {\n const exhaustive: never = a.type;\n throw new Error(`Unhandled WalletActivityType: ${exhaustive}`);\n }\n }\n}\n\nexport function walletActivitySubtitle(a: ApiWalletActivity): string | null {\n switch (a.type) {\n case \"SEND\": return a.counterparty ? `to ${short(a.counterparty)}` : null;\n case \"RECEIVE\": return a.counterparty ? `from ${short(a.counterparty)}` : null;\n case \"SWAP\": {\n const from = tokenAmount(a.tokenInAddress, a.amountIn);\n const to = tokenAmount(a.tokenOutAddress, a.amountOut);\n return from && to ? `${from} → ${to}` : null;\n }\n default: return null;\n }\n}\n\nexport function walletActivityAmount(a: ApiWalletActivity): string | null {\n if (a.type === \"SEND\" || a.type === \"RECEIVE\") return tokenAmount(a.tokenAddress, a.amount);\n return null;\n}\n"],"mappings":"AAAA,SAAS,yBAAyB;AAElC,SAAS,KAAK,aAAa;AAE3B,SAAS,YAAY,cAA6B,QAAsC;AACtF,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,QAAQ,eAAe,kBAAkB,YAAY,IAAI;AAC/D,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,GAAG,IAAI,OAAO,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,MAAM,MAAM;AAC/D;AAEO,SAAS,oBAAoB,GAA8B;AAChE,UAAQ,EAAE,MAAM;AAAA,IACd,KAAK;AAAQ,aAAO;AAAA,IACpB,KAAK;AAAW,aAAO;AAAA,IACvB,KAAK;AAAQ,aAAO;AAAA,IACpB,KAAK;AAAU,aAAO;AAAA,IACtB,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAA2B,aAAO;AAAA,IACvC,KAAK;AAA4B,aAAO;AAAA,IACxC,KAAK;AAA0B,aAAO;AAAA,IACtC,SAAS;AACP,YAAM,aAAoB,EAAE;AAC5B,YAAM,IAAI,MAAM,iCAAiC,UAAU,EAAE;AAAA,IAC/D;AAAA,EACF;AACF;AAEO,SAAS,uBAAuB,GAAqC;AAC1E,UAAQ,EAAE,MAAM;AAAA,IACd,KAAK;AAAQ,aAAO,EAAE,eAAe,MAAM,MAAM,EAAE,YAAY,CAAC,KAAK;AAAA,IACrE,KAAK;AAAW,aAAO,EAAE,eAAe,QAAQ,MAAM,EAAE,YAAY,CAAC,KAAK;AAAA,IAC1E,KAAK,QAAQ;AACX,YAAM,OAAO,YAAY,EAAE,gBAAgB,EAAE,QAAQ;AACrD,YAAM,KAAK,YAAY,EAAE,iBAAiB,EAAE,SAAS;AACrD,aAAO,QAAQ,KAAK,GAAG,IAAI,WAAM,EAAE,KAAK;AAAA,IAC1C;AAAA,IACA;AAAS,aAAO;AAAA,EAClB;AACF;AAEO,SAAS,qBAAqB,GAAqC;AACxE,MAAI,EAAE,SAAS,UAAU,EAAE,SAAS,UAAW,QAAO,YAAY,EAAE,cAAc,EAAE,MAAM;AAC1F,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var wallet_format_exports = {};
|
|
20
|
+
__export(wallet_format_exports, {
|
|
21
|
+
explorerTokenUrl: () => explorerTokenUrl,
|
|
22
|
+
explorerTxUrl: () => explorerTxUrl,
|
|
23
|
+
fmt: () => fmt,
|
|
24
|
+
fmtUsd: () => fmtUsd,
|
|
25
|
+
rawToNumber: () => rawToNumber,
|
|
26
|
+
short: () => short,
|
|
27
|
+
when: () => when
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(wallet_format_exports);
|
|
30
|
+
var import_sdk = require("@medialane/sdk");
|
|
31
|
+
const short = (a) => a && a.length > 12 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a ?? "";
|
|
32
|
+
const explorerTokenUrl = (explorerUrl, address) => `${explorerUrl}/token/${address}`;
|
|
33
|
+
const explorerTxUrl = (explorerUrl, txHash) => `${explorerUrl}/tx/${txHash}`;
|
|
34
|
+
const rawToNumber = (raw, decimals) => {
|
|
35
|
+
if (raw == null) return 0;
|
|
36
|
+
return Number(raw) / 10 ** decimals;
|
|
37
|
+
};
|
|
38
|
+
const fmt = (raw, decimals = 18, dp = 4) => {
|
|
39
|
+
if (raw == null) return "\u2014";
|
|
40
|
+
const [whole, frac = ""] = (0, import_sdk.formatAmount)(raw.toString(), decimals).split(".");
|
|
41
|
+
const t = frac.slice(0, dp).replace(/0+$/, "");
|
|
42
|
+
return t ? `${whole}.${t}` : whole;
|
|
43
|
+
};
|
|
44
|
+
const fmtUsd = (n) => n > 0 && n < 0.01 ? "<$0.01" : `$${n.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
45
|
+
const when = (iso) => {
|
|
46
|
+
const d = new Date(iso);
|
|
47
|
+
return Number.isNaN(d.getTime()) ? iso : d.toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
48
|
+
};
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
explorerTokenUrl,
|
|
52
|
+
explorerTxUrl,
|
|
53
|
+
fmt,
|
|
54
|
+
fmtUsd,
|
|
55
|
+
rawToNumber,
|
|
56
|
+
short,
|
|
57
|
+
when
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=wallet-format.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/media-wallet/wallet-format.ts"],"sourcesContent":["import { formatAmount } from \"@medialane/sdk\";\n\nexport const short = (a?: string | null): string =>\n a && a.length > 12 ? `${a.slice(0, 6)}…${a.slice(-4)}` : a ?? \"\";\n\nexport const explorerTokenUrl = (explorerUrl: string, address: string): string => `${explorerUrl}/token/${address}`;\nexport const explorerTxUrl = (explorerUrl: string, txHash: string): string => `${explorerUrl}/tx/${txHash}`;\n\nexport const rawToNumber = (raw: bigint | null, decimals: number): number => {\n if (raw == null) return 0;\n return Number(raw) / 10 ** decimals;\n};\n\nexport const fmt = (raw: bigint | null, decimals = 18, dp = 4): string => {\n if (raw == null) return \"—\";\n const [whole, frac = \"\"] = formatAmount(raw.toString(), decimals).split(\".\");\n const t = frac.slice(0, dp).replace(/0+$/, \"\");\n return t ? `${whole}.${t}` : whole;\n};\n\nexport const fmtUsd = (n: number): string =>\n n > 0 && n < 0.01 ? \"<$0.01\" : `$${n.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;\n\nexport const when = (iso: string): string => {\n const d = new Date(iso);\n return Number.isNaN(d.getTime())\n ? iso\n : d.toLocaleDateString(undefined, { month: \"short\", day: \"numeric\" });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA6B;AAEtB,MAAM,QAAQ,CAAC,MACpB,KAAK,EAAE,SAAS,KAAK,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,SAAI,EAAE,MAAM,EAAE,CAAC,KAAK,KAAK;AAEzD,MAAM,mBAAmB,CAAC,aAAqB,YAA4B,GAAG,WAAW,UAAU,OAAO;AAC1G,MAAM,gBAAgB,CAAC,aAAqB,WAA2B,GAAG,WAAW,OAAO,MAAM;AAElG,MAAM,cAAc,CAAC,KAAoB,aAA6B;AAC3E,MAAI,OAAO,KAAM,QAAO;AACxB,SAAO,OAAO,GAAG,IAAI,MAAM;AAC7B;AAEO,MAAM,MAAM,CAAC,KAAoB,WAAW,IAAI,KAAK,MAAc;AACxE,MAAI,OAAO,KAAM,QAAO;AACxB,QAAM,CAAC,OAAO,OAAO,EAAE,QAAI,yBAAa,IAAI,SAAS,GAAG,QAAQ,EAAE,MAAM,GAAG;AAC3E,QAAM,IAAI,KAAK,MAAM,GAAG,EAAE,EAAE,QAAQ,OAAO,EAAE;AAC7C,SAAO,IAAI,GAAG,KAAK,IAAI,CAAC,KAAK;AAC/B;AAEO,MAAM,SAAS,CAAC,MACrB,IAAI,KAAK,IAAI,OAAO,WAAW,IAAI,EAAE,eAAe,QAAW,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,CAAC,CAAC;AAEjH,MAAM,OAAO,CAAC,QAAwB;AAC3C,QAAM,IAAI,IAAI,KAAK,GAAG;AACtB,SAAO,OAAO,MAAM,EAAE,QAAQ,CAAC,IAC3B,MACA,EAAE,mBAAmB,QAAW,EAAE,OAAO,SAAS,KAAK,UAAU,CAAC;AACxE;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const short: (a?: string | null) => string;
|
|
2
|
+
declare const explorerTokenUrl: (explorerUrl: string, address: string) => string;
|
|
3
|
+
declare const explorerTxUrl: (explorerUrl: string, txHash: string) => string;
|
|
4
|
+
declare const rawToNumber: (raw: bigint | null, decimals: number) => number;
|
|
5
|
+
declare const fmt: (raw: bigint | null, decimals?: number, dp?: number) => string;
|
|
6
|
+
declare const fmtUsd: (n: number) => string;
|
|
7
|
+
declare const when: (iso: string) => string;
|
|
8
|
+
|
|
9
|
+
export { explorerTokenUrl, explorerTxUrl, fmt, fmtUsd, rawToNumber, short, when };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const short: (a?: string | null) => string;
|
|
2
|
+
declare const explorerTokenUrl: (explorerUrl: string, address: string) => string;
|
|
3
|
+
declare const explorerTxUrl: (explorerUrl: string, txHash: string) => string;
|
|
4
|
+
declare const rawToNumber: (raw: bigint | null, decimals: number) => number;
|
|
5
|
+
declare const fmt: (raw: bigint | null, decimals?: number, dp?: number) => string;
|
|
6
|
+
declare const fmtUsd: (n: number) => string;
|
|
7
|
+
declare const when: (iso: string) => string;
|
|
8
|
+
|
|
9
|
+
export { explorerTokenUrl, explorerTxUrl, fmt, fmtUsd, rawToNumber, short, when };
|