@t2000/sdk 9.14.0 → 10.0.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/browser.cjs +10 -10
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +9 -9
- package/dist/browser.js.map +1 -1
- package/dist/{commerce-DhJDA4Sq.d.cts → commerce-CUGyTRcv.d.cts} +9 -9
- package/dist/{commerce-DhJDA4Sq.d.ts → commerce-CUGyTRcv.d.ts} +9 -9
- package/dist/index.cjs +10 -10
- 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 +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/browser.cjs
CHANGED
|
@@ -1575,27 +1575,27 @@ async function commerceFetchJson(url, init) {
|
|
|
1575
1575
|
}
|
|
1576
1576
|
return json;
|
|
1577
1577
|
}
|
|
1578
|
-
async function
|
|
1578
|
+
async function listServices(base, filter = {}) {
|
|
1579
1579
|
const params = new URLSearchParams();
|
|
1580
1580
|
if (filter.agent) params.set("agent", filter.agent);
|
|
1581
1581
|
if (filter.query) params.set("q", filter.query);
|
|
1582
1582
|
const qs = params.size > 0 ? `?${params.toString()}` : "";
|
|
1583
|
-
const json = await commerceFetchJson(`${base}/
|
|
1584
|
-
const
|
|
1585
|
-
return { total: json.total ??
|
|
1583
|
+
const json = await commerceFetchJson(`${base}/services${qs}`);
|
|
1584
|
+
const services = json.services ?? [];
|
|
1585
|
+
return { total: json.total ?? services.length, services };
|
|
1586
1586
|
}
|
|
1587
|
-
async function
|
|
1588
|
-
const {
|
|
1587
|
+
async function fetchService(base, agent, slug) {
|
|
1588
|
+
const { services: rows } = await listServices(base, { agent });
|
|
1589
1589
|
const match = rows.find((o) => o.slug === slug.trim().toLowerCase());
|
|
1590
1590
|
if (!match) {
|
|
1591
1591
|
const live = rows.filter((o) => !o.retired).map((o) => o.slug);
|
|
1592
1592
|
throw new Error(
|
|
1593
|
-
`Agent ${truncateAddress(agent)} has no
|
|
1593
|
+
`Agent ${truncateAddress(agent)} has no service "${slug}".` + (live.length > 0 ? ` Live services: ${live.join(", ")}` : "")
|
|
1594
1594
|
);
|
|
1595
1595
|
}
|
|
1596
1596
|
if (match.retired) {
|
|
1597
1597
|
throw new Error(
|
|
1598
|
-
`
|
|
1598
|
+
`Service "${slug}" is retired \u2014 the seller no longer sells it.`
|
|
1599
1599
|
);
|
|
1600
1600
|
}
|
|
1601
1601
|
return match;
|
|
@@ -1678,7 +1678,7 @@ exports.extractTransferDetails = extractTransferDetails;
|
|
|
1678
1678
|
exports.extractTxCommands = extractTxCommands;
|
|
1679
1679
|
exports.extractTxSender = extractTxSender;
|
|
1680
1680
|
exports.fallbackLabel = fallbackLabel;
|
|
1681
|
-
exports.
|
|
1681
|
+
exports.fetchService = fetchService;
|
|
1682
1682
|
exports.findSwapRoute = findSwapRoute;
|
|
1683
1683
|
exports.formatAssetAmount = formatAssetAmount;
|
|
1684
1684
|
exports.formatSui = formatSui;
|
|
@@ -1689,7 +1689,7 @@ exports.getDecimalsForCoinType = getDecimalsForCoinType;
|
|
|
1689
1689
|
exports.getJob = getJob;
|
|
1690
1690
|
exports.getJobSpec = getJobSpec;
|
|
1691
1691
|
exports.jobActionsFor = jobActionsFor;
|
|
1692
|
-
exports.
|
|
1692
|
+
exports.listServices = listServices;
|
|
1693
1693
|
exports.mapMoveAbortCode = mapMoveAbortCode;
|
|
1694
1694
|
exports.mapWalletError = mapWalletError;
|
|
1695
1695
|
exports.mistToSui = mistToSui;
|