@aomi-labs/client 0.1.8 → 0.1.9
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/cli.js +58 -22
- package/dist/index.cjs +57 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +57 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -687,13 +687,13 @@ interface PimlicoResolvedConfig {
|
|
|
687
687
|
declare function resolvePimlicoConfig(options: PimlicoResolveOptions): PimlicoResolvedConfig | null;
|
|
688
688
|
|
|
689
689
|
type CreateAAOwner = {
|
|
690
|
+
kind: "direct";
|
|
690
691
|
privateKey: `0x${string}`;
|
|
691
692
|
} | {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
para: unknown;
|
|
693
|
+
kind: "session";
|
|
694
|
+
adapter: string;
|
|
695
|
+
session: unknown;
|
|
696
|
+
signer?: unknown;
|
|
697
697
|
address?: Hex;
|
|
698
698
|
};
|
|
699
699
|
interface CreateAAProviderStateOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -687,13 +687,13 @@ interface PimlicoResolvedConfig {
|
|
|
687
687
|
declare function resolvePimlicoConfig(options: PimlicoResolveOptions): PimlicoResolvedConfig | null;
|
|
688
688
|
|
|
689
689
|
type CreateAAOwner = {
|
|
690
|
+
kind: "direct";
|
|
690
691
|
privateKey: `0x${string}`;
|
|
691
692
|
} | {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
para: unknown;
|
|
693
|
+
kind: "session";
|
|
694
|
+
adapter: string;
|
|
695
|
+
session: unknown;
|
|
696
|
+
signer?: unknown;
|
|
697
697
|
address?: Hex;
|
|
698
698
|
};
|
|
699
699
|
interface CreateAAProviderStateOptions {
|
package/dist/index.js
CHANGED
|
@@ -1650,28 +1650,50 @@ async function createAAProviderState(options) {
|
|
|
1650
1650
|
apiKey: options.apiKey
|
|
1651
1651
|
});
|
|
1652
1652
|
}
|
|
1653
|
-
function
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
if ("privateKey" in owner) {
|
|
1658
|
-
return {
|
|
1653
|
+
function getDirectOwnerParams(owner) {
|
|
1654
|
+
return {
|
|
1655
|
+
kind: "ready",
|
|
1656
|
+
ownerParams: {
|
|
1659
1657
|
para: void 0,
|
|
1660
1658
|
signer: privateKeyToAccount(owner.privateKey)
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
function getParaSessionOwnerParams(owner) {
|
|
1663
|
+
if (owner.signer) {
|
|
1664
|
+
return {
|
|
1665
|
+
kind: "ready",
|
|
1666
|
+
ownerParams: __spreadValues({
|
|
1667
|
+
para: owner.session,
|
|
1668
|
+
signer: owner.signer
|
|
1669
|
+
}, owner.address ? { address: owner.address } : {})
|
|
1661
1670
|
};
|
|
1662
1671
|
}
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
}, owner.address ? { address: owner.address } : {})
|
|
1672
|
+
return {
|
|
1673
|
+
kind: "ready",
|
|
1674
|
+
ownerParams: __spreadValues({
|
|
1675
|
+
para: owner.session
|
|
1676
|
+
}, owner.address ? { address: owner.address } : {})
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
function getSessionOwnerParams(owner) {
|
|
1680
|
+
switch (owner.adapter) {
|
|
1681
|
+
case "para":
|
|
1682
|
+
return getParaSessionOwnerParams(owner);
|
|
1683
|
+
default:
|
|
1684
|
+
return { kind: "unsupported_adapter", adapter: owner.adapter };
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
function getOwnerParams(owner) {
|
|
1688
|
+
if (!owner) {
|
|
1689
|
+
return { kind: "missing" };
|
|
1668
1690
|
}
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1691
|
+
switch (owner.kind) {
|
|
1692
|
+
case "direct":
|
|
1693
|
+
return getDirectOwnerParams(owner);
|
|
1694
|
+
case "session":
|
|
1695
|
+
return getSessionOwnerParams(owner);
|
|
1673
1696
|
}
|
|
1674
|
-
return null;
|
|
1675
1697
|
}
|
|
1676
1698
|
function getMissingOwnerState(plan, provider) {
|
|
1677
1699
|
return {
|
|
@@ -1679,10 +1701,18 @@ function getMissingOwnerState(plan, provider) {
|
|
|
1679
1701
|
AA: null,
|
|
1680
1702
|
isPending: false,
|
|
1681
1703
|
error: new Error(
|
|
1682
|
-
`${provider} AA account creation requires a
|
|
1704
|
+
`${provider} AA account creation requires a direct owner or a supported session owner.`
|
|
1683
1705
|
)
|
|
1684
1706
|
};
|
|
1685
1707
|
}
|
|
1708
|
+
function getUnsupportedAdapterState(plan, adapter) {
|
|
1709
|
+
return {
|
|
1710
|
+
plan,
|
|
1711
|
+
AA: null,
|
|
1712
|
+
isPending: false,
|
|
1713
|
+
error: new Error(`Session adapter "${adapter}" is not implemented.`)
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1686
1716
|
async function createAlchemyAAState(options) {
|
|
1687
1717
|
var _a, _b;
|
|
1688
1718
|
const {
|
|
@@ -1712,11 +1742,14 @@ async function createAlchemyAAState(options) {
|
|
|
1712
1742
|
fallbackToEoa: false
|
|
1713
1743
|
});
|
|
1714
1744
|
const ownerParams = getOwnerParams(owner);
|
|
1715
|
-
if (
|
|
1745
|
+
if (ownerParams.kind === "missing") {
|
|
1716
1746
|
return getMissingOwnerState(plan, "alchemy");
|
|
1717
1747
|
}
|
|
1748
|
+
if (ownerParams.kind === "unsupported_adapter") {
|
|
1749
|
+
return getUnsupportedAdapterState(plan, ownerParams.adapter);
|
|
1750
|
+
}
|
|
1718
1751
|
try {
|
|
1719
|
-
const smartAccount = await createAlchemySmartAccount(__spreadProps(__spreadValues({}, ownerParams), {
|
|
1752
|
+
const smartAccount = await createAlchemySmartAccount(__spreadProps(__spreadValues({}, ownerParams.ownerParams), {
|
|
1720
1753
|
apiKey,
|
|
1721
1754
|
gasPolicyId,
|
|
1722
1755
|
chain,
|
|
@@ -1771,11 +1804,14 @@ async function createPimlicoAAState(options) {
|
|
|
1771
1804
|
fallbackToEoa: false
|
|
1772
1805
|
});
|
|
1773
1806
|
const ownerParams = getOwnerParams(owner);
|
|
1774
|
-
if (
|
|
1807
|
+
if (ownerParams.kind === "missing") {
|
|
1775
1808
|
return getMissingOwnerState(plan, "pimlico");
|
|
1776
1809
|
}
|
|
1810
|
+
if (ownerParams.kind === "unsupported_adapter") {
|
|
1811
|
+
return getUnsupportedAdapterState(plan, ownerParams.adapter);
|
|
1812
|
+
}
|
|
1777
1813
|
try {
|
|
1778
|
-
const smartAccount = await createPimlicoSmartAccount(__spreadProps(__spreadValues({}, ownerParams), {
|
|
1814
|
+
const smartAccount = await createPimlicoSmartAccount(__spreadProps(__spreadValues({}, ownerParams.ownerParams), {
|
|
1779
1815
|
apiKey,
|
|
1780
1816
|
chain,
|
|
1781
1817
|
rpcUrl,
|