@atxp/base 0.9.2 → 0.10.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/baseAccount.d.ts +5 -1
- package/dist/baseAccount.d.ts.map +1 -1
- package/dist/baseAccount.js +7 -1
- package/dist/baseAccount.js.map +1 -1
- package/dist/baseAppAccount.d.ts +5 -1
- package/dist/baseAppAccount.d.ts.map +1 -1
- package/dist/baseAppAccount.js +8 -2
- package/dist/baseAppAccount.js.map +1 -1
- package/dist/index.cjs +15 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ interface EphemeralSmartWallet {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
declare class BaseAppAccount implements Account$1 {
|
|
100
|
-
|
|
100
|
+
private _accountId;
|
|
101
101
|
paymentMakers: PaymentMaker[];
|
|
102
102
|
private mainWalletAddress?;
|
|
103
103
|
private ephemeralSmartWallet?;
|
|
@@ -116,6 +116,10 @@ declare class BaseAppAccount implements Account$1 {
|
|
|
116
116
|
private static loadSavedWalletAndPermission;
|
|
117
117
|
private static deploySmartWallet;
|
|
118
118
|
constructor(spendPermission: SpendPermission | null, ephemeralSmartWallet: EphemeralSmartWallet | null, logger?: Logger, mainWalletAddress?: string, provider?: MainWalletProvider, chainId?: number);
|
|
119
|
+
/**
|
|
120
|
+
* Get the account ID
|
|
121
|
+
*/
|
|
122
|
+
getAccountId(): Promise<AccountId>;
|
|
119
123
|
getSources(): Promise<Source[]>;
|
|
120
124
|
/**
|
|
121
125
|
* Dynamically import the appropriate spend-permission module based on environment.
|
|
@@ -147,11 +151,15 @@ declare class BaseAppPaymentMaker implements PaymentMaker {
|
|
|
147
151
|
}
|
|
148
152
|
|
|
149
153
|
declare class BaseAccount implements Account$2 {
|
|
150
|
-
|
|
154
|
+
private _accountId;
|
|
151
155
|
paymentMakers: PaymentMaker$1[];
|
|
152
156
|
private walletClient;
|
|
153
157
|
private account;
|
|
154
158
|
constructor(baseRPCUrl: string, sourceSecretKey: string);
|
|
159
|
+
/**
|
|
160
|
+
* Get the account ID
|
|
161
|
+
*/
|
|
162
|
+
getAccountId(): Promise<AccountId>;
|
|
155
163
|
/**
|
|
156
164
|
* Get the LocalAccount (signer) for this account.
|
|
157
165
|
* This can be used with the x402 library or other signing operations.
|
package/dist/index.js
CHANGED
|
@@ -5441,7 +5441,7 @@ class BaseAppAccount {
|
|
|
5441
5441
|
throw new Error('Spend permission is required for ephemeral wallet mode');
|
|
5442
5442
|
}
|
|
5443
5443
|
// Format accountId as network:address
|
|
5444
|
-
this.
|
|
5444
|
+
this._accountId = `base:${ephemeralSmartWallet.address}`;
|
|
5445
5445
|
this.ephemeralSmartWallet = ephemeralSmartWallet;
|
|
5446
5446
|
this.paymentMakers = [
|
|
5447
5447
|
new BaseAppPaymentMaker(spendPermission, ephemeralSmartWallet, logger, chainId)
|
|
@@ -5453,13 +5453,19 @@ class BaseAppAccount {
|
|
|
5453
5453
|
throw new Error('Main wallet address and provider are required for main wallet mode');
|
|
5454
5454
|
}
|
|
5455
5455
|
// Format accountId as network:address
|
|
5456
|
-
this.
|
|
5456
|
+
this._accountId = `base:${mainWalletAddress}`;
|
|
5457
5457
|
this.mainWalletAddress = mainWalletAddress;
|
|
5458
5458
|
this.paymentMakers = [
|
|
5459
5459
|
new MainWalletPaymentMaker(mainWalletAddress, provider, logger, chainId)
|
|
5460
5460
|
];
|
|
5461
5461
|
}
|
|
5462
5462
|
}
|
|
5463
|
+
/**
|
|
5464
|
+
* Get the account ID
|
|
5465
|
+
*/
|
|
5466
|
+
async getAccountId() {
|
|
5467
|
+
return this._accountId;
|
|
5468
|
+
}
|
|
5463
5469
|
async getSources() {
|
|
5464
5470
|
const address = this.ephemeralSmartWallet?.address || this.mainWalletAddress;
|
|
5465
5471
|
if (!address) {
|
|
@@ -5689,7 +5695,7 @@ class BaseAccount {
|
|
|
5689
5695
|
}
|
|
5690
5696
|
this.account = privateKeyToAccount(sourceSecretKey);
|
|
5691
5697
|
// Format accountId as network:address
|
|
5692
|
-
this.
|
|
5698
|
+
this._accountId = `base:${this.account.address}`;
|
|
5693
5699
|
this.walletClient = createWalletClient({
|
|
5694
5700
|
account: this.account,
|
|
5695
5701
|
chain: base,
|
|
@@ -5699,6 +5705,12 @@ class BaseAccount {
|
|
|
5699
5705
|
new BasePaymentMaker(baseRPCUrl, this.walletClient)
|
|
5700
5706
|
];
|
|
5701
5707
|
}
|
|
5708
|
+
/**
|
|
5709
|
+
* Get the account ID
|
|
5710
|
+
*/
|
|
5711
|
+
async getAccountId() {
|
|
5712
|
+
return this._accountId;
|
|
5713
|
+
}
|
|
5702
5714
|
/**
|
|
5703
5715
|
* Get the LocalAccount (signer) for this account.
|
|
5704
5716
|
* This can be used with the x402 library or other signing operations.
|