@aastar/sdk 0.20.8 → 0.21.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/BaseClient-CkBhQ1ou.d.cts +88 -0
- package/dist/UserClient-BDGP37PK.js +6 -0
- package/dist/{UserClient-AIIHB54I.js.map → UserClient-BDGP37PK.js.map} +1 -1
- package/dist/UserClient-FOAOBLGK.cjs +15 -0
- package/dist/UserClient-FOAOBLGK.cjs.map +1 -0
- package/dist/account.cjs +31 -0
- package/dist/account.cjs.map +1 -0
- package/dist/account.d.cts +48 -0
- package/dist/account.js +3 -3
- package/dist/admin.cjs +15 -0
- package/dist/admin.cjs.map +1 -0
- package/dist/admin.d.cts +62 -0
- package/dist/admin.js +3 -3
- package/dist/airaccount.cjs +452 -0
- package/dist/airaccount.cjs.map +1 -0
- package/dist/airaccount.d.cts +4 -0
- package/dist/airaccount.js +3 -3
- package/dist/channel-CkRRbzT8.d.cts +77 -0
- package/dist/channel.cjs +27 -0
- package/dist/channel.cjs.map +1 -0
- package/dist/channel.d.cts +64 -0
- package/dist/channel.js +3 -3
- package/dist/chunk-3HZEIFBW.cjs +118 -0
- package/dist/chunk-3HZEIFBW.cjs.map +1 -0
- package/dist/{chunk-7ARJ3OSU.js → chunk-57XLR2NT.js} +3 -3
- package/dist/{chunk-7ARJ3OSU.js.map → chunk-57XLR2NT.js.map} +1 -1
- package/dist/chunk-5JFYTJOE.cjs +448 -0
- package/dist/chunk-5JFYTJOE.cjs.map +1 -0
- package/dist/{chunk-KDH3UPKD.js → chunk-5NKU5NT5.js} +8 -8
- package/dist/{chunk-KDH3UPKD.js.map → chunk-5NKU5NT5.js.map} +1 -1
- package/dist/chunk-63JM67L7.cjs +435 -0
- package/dist/chunk-63JM67L7.cjs.map +1 -0
- package/dist/{chunk-IC3G6YM2.js → chunk-6OWZOTE7.js} +113 -9
- package/dist/chunk-6OWZOTE7.js.map +1 -0
- package/dist/chunk-CIEYY3A6.cjs +43259 -0
- package/dist/chunk-CIEYY3A6.cjs.map +1 -0
- package/dist/chunk-DEUBKZH5.cjs +421 -0
- package/dist/chunk-DEUBKZH5.cjs.map +1 -0
- package/dist/{chunk-TENYCMJ3.js → chunk-DF4WVR2H.js} +9 -9
- package/dist/{chunk-TENYCMJ3.js.map → chunk-DF4WVR2H.js.map} +1 -1
- package/dist/{chunk-BN5WY5GM.js → chunk-DQBKE4ND.js} +4 -4
- package/dist/{chunk-BN5WY5GM.js.map → chunk-DQBKE4ND.js.map} +1 -1
- package/dist/{chunk-4EZD7LPE.js → chunk-E4CQFW75.js} +3 -3
- package/dist/{chunk-4EZD7LPE.js.map → chunk-E4CQFW75.js.map} +1 -1
- package/dist/{chunk-LXWIPTPX.js → chunk-ENSMYCU6.js} +3 -3
- package/dist/{chunk-LXWIPTPX.js.map → chunk-ENSMYCU6.js.map} +1 -1
- package/dist/{chunk-FJ7XECC5.js → chunk-EY2AJTGV.js} +3 -3
- package/dist/{chunk-FJ7XECC5.js.map → chunk-EY2AJTGV.js.map} +1 -1
- package/dist/chunk-GAMSWXWI.cjs +1168 -0
- package/dist/chunk-GAMSWXWI.cjs.map +1 -0
- package/dist/chunk-IJN776TA.cjs +585 -0
- package/dist/chunk-IJN776TA.cjs.map +1 -0
- package/dist/{chunk-PKCHRXFR.js → chunk-KZERVPUR.js} +3 -3
- package/dist/{chunk-PKCHRXFR.js.map → chunk-KZERVPUR.js.map} +1 -1
- package/dist/{chunk-6QYXGMCR.js → chunk-M5WFKETT.js} +833 -47
- package/dist/chunk-M5WFKETT.js.map +1 -0
- package/dist/chunk-M7HXR7G5.cjs +128 -0
- package/dist/chunk-M7HXR7G5.cjs.map +1 -0
- package/dist/{chunk-PAABYXS6.js → chunk-MCALA6WM.js} +6 -6
- package/dist/{chunk-PAABYXS6.js.map → chunk-MCALA6WM.js.map} +1 -1
- package/dist/chunk-MXJEULSE.cjs +396 -0
- package/dist/chunk-MXJEULSE.cjs.map +1 -0
- package/dist/chunk-OVNOSAL3.cjs +4797 -0
- package/dist/chunk-OVNOSAL3.cjs.map +1 -0
- package/dist/chunk-Q7SFCCGT.cjs +11 -0
- package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
- package/dist/{chunk-MVEWJIPY.js → chunk-RXPSL33E.js} +3 -3
- package/dist/{chunk-MVEWJIPY.js.map → chunk-RXPSL33E.js.map} +1 -1
- package/dist/{chunk-G3UJC4EL.js → chunk-UCLK6LTB.js} +39 -36
- package/dist/chunk-UCLK6LTB.js.map +1 -0
- package/dist/chunk-WR4OZUXR.cjs +115 -0
- package/dist/chunk-WR4OZUXR.cjs.map +1 -0
- package/dist/chunk-XQROKLZI.cjs +4521 -0
- package/dist/chunk-XQROKLZI.cjs.map +1 -0
- package/dist/chunk-Y4EJX7UA.cjs +228 -0
- package/dist/chunk-Y4EJX7UA.cjs.map +1 -0
- package/dist/chunk-Z4GZ6DQA.cjs +108 -0
- package/dist/chunk-Z4GZ6DQA.cjs.map +1 -0
- package/dist/contract-addresses-RABD77VP.cjs +49 -0
- package/dist/contract-addresses-RABD77VP.cjs.map +1 -0
- package/dist/{contract-addresses-N3TOL2WL.js → contract-addresses-TVXSRQ7I.js} +3 -3
- package/dist/{contract-addresses-N3TOL2WL.js.map → contract-addresses-TVXSRQ7I.js.map} +1 -1
- package/dist/core.cjs +898 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +7048 -0
- package/dist/core.d.ts +130 -12
- package/dist/core.js +2 -2
- package/dist/dapp.cjs +289 -0
- package/dist/dapp.cjs.map +1 -0
- package/dist/dapp.d.cts +127 -0
- package/dist/dapp.js +3 -3
- package/dist/doc-types-471vSmPO.d.cts +16 -0
- package/dist/enduser.cjs +24 -0
- package/dist/enduser.cjs.map +1 -0
- package/dist/enduser.d.cts +261 -0
- package/dist/enduser.js +4 -4
- package/dist/identity.cjs +23 -0
- package/dist/identity.cjs.map +1 -0
- package/dist/identity.d.cts +81 -0
- package/dist/identity.js +3 -3
- package/dist/index-B6SfEQxo.d.cts +47 -0
- package/dist/index.cjs +2818 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +656 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -17
- package/dist/kms.cjs +452 -0
- package/dist/kms.cjs.map +1 -0
- package/dist/kms.d.cts +3104 -0
- package/dist/kms.d.ts +62 -12
- package/dist/kms.js +3 -3
- package/dist/lib-FE4GR7TO.cjs +1865 -0
- package/dist/lib-FE4GR7TO.cjs.map +1 -0
- package/dist/operator.cjs +27 -0
- package/dist/operator.cjs.map +1 -0
- package/dist/operator.d.cts +164 -0
- package/dist/operator.js +3 -3
- package/dist/paymaster.cjs +63 -0
- package/dist/paymaster.cjs.map +1 -0
- package/dist/paymaster.d.cts +312 -0
- package/dist/paymaster.js +3 -3
- package/dist/src-CUHI6G6W.cjs +898 -0
- package/dist/src-CUHI6G6W.cjs.map +1 -0
- package/dist/src-KHCWIS4Q.cjs +63 -0
- package/dist/src-KHCWIS4Q.cjs.map +1 -0
- package/dist/{src-X5MIV3EB.js → src-RSN4U2T2.js} +5 -5
- package/dist/src-RSN4U2T2.js.map +1 -0
- package/dist/{src-L5SI5WNB.js → src-XCV6BTSV.js} +4 -4
- package/dist/{src-X5MIV3EB.js.map → src-XCV6BTSV.js.map} +1 -1
- package/dist/tier-router-DeeVg69O.d.cts +370 -0
- package/dist/tokens.cjs +15 -0
- package/dist/tokens.cjs.map +1 -0
- package/dist/tokens.d.cts +64 -0
- package/dist/tokens.js +3 -3
- package/dist/x402.cjs +103 -0
- package/dist/x402.cjs.map +1 -0
- package/dist/x402.d.cts +373 -0
- package/dist/x402.js +3 -3
- package/package.json +116 -32
- package/dist/UserClient-AIIHB54I.js +0 -6
- package/dist/chunk-6QYXGMCR.js.map +0 -1
- package/dist/chunk-G3UJC4EL.js.map +0 -1
- package/dist/chunk-IC3G6YM2.js.map +0 -1
- package/dist/src-L5SI5WNB.js.map +0 -1
package/dist/dapp.d.cts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { WalletClient, Address, Hex } from 'viem';
|
|
2
|
+
import { P as PaymasterConfig } from './index-B6SfEQxo.cjs';
|
|
3
|
+
|
|
4
|
+
declare class DVTClient {
|
|
5
|
+
static registerValidator(wallet: WalletClient, dvtAddr: Address, blsPublicKey: Hex): Promise<`0x${string}`>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type UseCreditScoreConfig = {
|
|
9
|
+
chain: any;
|
|
10
|
+
rpcUrl?: string;
|
|
11
|
+
registryAddress: Address;
|
|
12
|
+
userAddress: Address;
|
|
13
|
+
transport?: any;
|
|
14
|
+
};
|
|
15
|
+
declare function useCreditScore({ chain, rpcUrl, registryAddress, userAddress }: UseCreditScoreConfig): {
|
|
16
|
+
creditLimit: bigint | null;
|
|
17
|
+
loading: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type UseSuperPaymasterResult = {
|
|
21
|
+
generatePaymasterAndData: (userOp: any) => Promise<string>;
|
|
22
|
+
isLoading: boolean;
|
|
23
|
+
error: Error | null;
|
|
24
|
+
};
|
|
25
|
+
declare function useSuperPaymaster(config: PaymasterConfig): UseSuperPaymasterResult;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* eip1193.ts — EIP-1193 compatible provider wrapping AirAccount M7.
|
|
29
|
+
*
|
|
30
|
+
* Intercepts eth_sendTransaction and converts it to an ERC-4337 v0.7
|
|
31
|
+
* PackedUserOperation submitted to the bundler via eth_sendUserOperation.
|
|
32
|
+
* All other JSON-RPC methods are forwarded to the public RPC.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
interface AirAccountProviderConfig {
|
|
36
|
+
/** EVM chain ID */
|
|
37
|
+
chainId: number;
|
|
38
|
+
/** Public JSON-RPC URL */
|
|
39
|
+
rpcUrl: string;
|
|
40
|
+
/** ERC-4337 bundler URL */
|
|
41
|
+
bundlerUrl: string;
|
|
42
|
+
/** EntryPoint v0.7 address (defaults to canonical) */
|
|
43
|
+
entryPoint?: Address;
|
|
44
|
+
/** The user's AirAccount smart contract address */
|
|
45
|
+
accountAddress: Address;
|
|
46
|
+
/**
|
|
47
|
+
* Signs the UserOp hash and returns a 65-byte hex signature.
|
|
48
|
+
* For passkey/ECDSA, format as M7 composite validator signature.
|
|
49
|
+
*/
|
|
50
|
+
signer: (userOpHash: Hex) => Promise<Hex>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* AirAccountEIP1193Provider — drop-in EIP-1193 wallet backed by an AirAccount M7 smart account.
|
|
54
|
+
*
|
|
55
|
+
* Usage:
|
|
56
|
+
* ```ts
|
|
57
|
+
* const provider = new AirAccountEIP1193Provider({
|
|
58
|
+
* chainId: 11155111,
|
|
59
|
+
* rpcUrl: 'https://rpc.sepolia.org',
|
|
60
|
+
* bundlerUrl: 'https://api.pimlico.io/v2/11155111/rpc?apikey=...',
|
|
61
|
+
* accountAddress: '0x...',
|
|
62
|
+
* signer: async (hash) => passkeySign(hash),
|
|
63
|
+
* });
|
|
64
|
+
* // Pass to wagmi, ethers.js BrowserProvider, or window.ethereum
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
declare class AirAccountEIP1193Provider {
|
|
68
|
+
private readonly config;
|
|
69
|
+
private readonly client;
|
|
70
|
+
private readonly listeners;
|
|
71
|
+
constructor(config: AirAccountProviderConfig);
|
|
72
|
+
request({ method, params }: {
|
|
73
|
+
method: string;
|
|
74
|
+
params?: unknown[];
|
|
75
|
+
}): Promise<unknown>;
|
|
76
|
+
on(event: string, listener: (...args: unknown[]) => void): this;
|
|
77
|
+
removeListener(event: string, listener: (...args: unknown[]) => void): this;
|
|
78
|
+
private _sendTransaction;
|
|
79
|
+
private _forwardToRpc;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* eip6963.ts — EIP-6963 Multi Injected Provider Discovery for AirAccount.
|
|
84
|
+
*
|
|
85
|
+
* Announces AirAccount as an EIP-1193 wallet via the eip6963:announceProvider
|
|
86
|
+
* DOM event, enabling DApps to auto-discover it without relying on window.ethereum.
|
|
87
|
+
*
|
|
88
|
+
* Reference: https://eips.ethereum.org/EIPS/eip-6963
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
interface EIP6963ProviderInfo {
|
|
92
|
+
/** Globally unique wallet identifier (UUID v4). Must not change across sessions. */
|
|
93
|
+
uuid: string;
|
|
94
|
+
/** Human-readable wallet name displayed in DApp UI */
|
|
95
|
+
name: string;
|
|
96
|
+
/** Wallet icon as a data URI (SVG or PNG, base64) */
|
|
97
|
+
icon: string;
|
|
98
|
+
/** Reverse-DNS identifier, e.g. "community.aastar.airaccount" */
|
|
99
|
+
rdns: string;
|
|
100
|
+
}
|
|
101
|
+
interface EIP6963ProviderDetail {
|
|
102
|
+
info: EIP6963ProviderInfo;
|
|
103
|
+
provider: AirAccountEIP1193Provider;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Announce AirAccount as an EIP-6963 wallet so DApps can auto-discover it.
|
|
107
|
+
*
|
|
108
|
+
* Call this once at app startup. Returns a cleanup function that removes the
|
|
109
|
+
* event listener when the wallet is no longer available.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* const provider = new AirAccountEIP1193Provider({ ... });
|
|
114
|
+
* const cleanup = announceAirAccount(provider);
|
|
115
|
+
* // later: cleanup() to stop announcing
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare function announceAirAccount(provider: AirAccountEIP1193Provider, info?: Partial<EIP6963ProviderInfo>): () => void;
|
|
119
|
+
/**
|
|
120
|
+
* Listen for EIP-6963 wallet announcements from other providers in the page.
|
|
121
|
+
* Useful for composing AirAccount with MetaMask fallback, etc.
|
|
122
|
+
*
|
|
123
|
+
* Returns a cleanup function to stop listening.
|
|
124
|
+
*/
|
|
125
|
+
declare function watchProviders(onProvider: (detail: EIP6963ProviderDetail) => void): () => void;
|
|
126
|
+
|
|
127
|
+
export { AirAccountEIP1193Provider, type AirAccountProviderConfig, DVTClient, type EIP6963ProviderDetail, type EIP6963ProviderInfo, announceAirAccount, useCreditScore, useSuperPaymaster, watchProviders };
|
package/dist/dapp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getSuperPaymasterMiddleware } from './chunk-
|
|
2
|
-
import { createAAStarPublicClient, RegistryABI } from './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
import { getSuperPaymasterMiddleware } from './chunk-RXPSL33E.js';
|
|
2
|
+
import { createAAStarPublicClient, RegistryABI } from './chunk-M5WFKETT.js';
|
|
3
|
+
import './chunk-UCLK6LTB.js';
|
|
4
4
|
import './chunk-PZ5AY32C.js';
|
|
5
5
|
import { parseAbi, createPublicClient, http, hashTypedData, hashMessage, hexToBytes, encodeFunctionData } from 'viem';
|
|
6
6
|
import { useState, useEffect, useCallback } from 'react';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PublicClient as PublicClient$1, Transport, Chain, Account, WalletClient as WalletClient$1 } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Public Client Interface
|
|
5
|
+
* Standardized interface for reading from the blockchain.
|
|
6
|
+
*/
|
|
7
|
+
interface PublicClient extends PublicClient$1 {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Wallet Client Interface
|
|
11
|
+
* Standardized interface for interacting with Ethereum wallets and accounts.
|
|
12
|
+
*/
|
|
13
|
+
interface WalletClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined> extends WalletClient$1<TTransport, TChain, TAccount> {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type { PublicClient as P, WalletClient as W };
|
package/dist/enduser.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk63JM67L7_cjs = require('./chunk-63JM67L7.cjs');
|
|
4
|
+
var chunkDEUBKZH5_cjs = require('./chunk-DEUBKZH5.cjs');
|
|
5
|
+
require('./chunk-CIEYY3A6.cjs');
|
|
6
|
+
require('./chunk-MXJEULSE.cjs');
|
|
7
|
+
require('./chunk-Q7SFCCGT.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(exports, "CommunityClient", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunk63JM67L7_cjs.CommunityClient; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "UserLifecycle", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunk63JM67L7_cjs.UserLifecycle; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "UserClient", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkDEUBKZH5_cjs.UserClient; }
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=enduser.cjs.map
|
|
24
|
+
//# sourceMappingURL=enduser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"enduser.cjs"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { Address, Hash, Hex } from 'viem';
|
|
2
|
+
import { C as ClientConfig, a as BaseClient, T as TransactionOptions } from './BaseClient-CkBhQ1ou.cjs';
|
|
3
|
+
import './doc-types-471vSmPO.cjs';
|
|
4
|
+
|
|
5
|
+
interface UserClientConfig extends ClientConfig {
|
|
6
|
+
accountAddress: Address;
|
|
7
|
+
sbtAddress?: Address;
|
|
8
|
+
entryPointAddress?: Address;
|
|
9
|
+
superPaymasterAddress?: Address;
|
|
10
|
+
gTokenStakingAddress?: Address;
|
|
11
|
+
registryAddress?: Address;
|
|
12
|
+
gTokenAddress?: Address;
|
|
13
|
+
bundlerClient?: any;
|
|
14
|
+
}
|
|
15
|
+
declare class UserClient extends BaseClient {
|
|
16
|
+
accountAddress: Address;
|
|
17
|
+
sbtAddress?: Address;
|
|
18
|
+
entryPointAddress?: Address;
|
|
19
|
+
gTokenStakingAddress?: Address;
|
|
20
|
+
registryAddress?: Address;
|
|
21
|
+
gTokenAddress?: Address;
|
|
22
|
+
bundlerClient?: any;
|
|
23
|
+
constructor(config: UserClientConfig);
|
|
24
|
+
/**
|
|
25
|
+
* Deploy a new Smart Account (Supports multiple factory types)
|
|
26
|
+
* Static helper to facilitate onboarding before instantiating the UserClient.
|
|
27
|
+
*
|
|
28
|
+
* @param client - WalletClient to sign the deployment transaction
|
|
29
|
+
* @param params - Deployment parameters
|
|
30
|
+
* @returns Object containing the deployed account address and transaction hash
|
|
31
|
+
*/
|
|
32
|
+
static deployAccount(client: any, params: {
|
|
33
|
+
owner: Address;
|
|
34
|
+
salt?: bigint;
|
|
35
|
+
factoryAddress?: Address;
|
|
36
|
+
publicClient?: any;
|
|
37
|
+
accountType?: 'simple' | 'kernel' | 'safe' | string;
|
|
38
|
+
customAbi?: any;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
accountAddress: Address;
|
|
41
|
+
hash: Hash;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Get the nonce of the account from EntryPoint (more reliable for 4337)
|
|
45
|
+
*/
|
|
46
|
+
getNonce(key?: bigint): Promise<bigint>;
|
|
47
|
+
/**
|
|
48
|
+
* Get the owner of the AA account
|
|
49
|
+
*/
|
|
50
|
+
getOwner(): Promise<Address>;
|
|
51
|
+
/**
|
|
52
|
+
* Execute a transaction from the AA account
|
|
53
|
+
*/
|
|
54
|
+
execute(target: Address, value: bigint, data: Hex, options?: TransactionOptions): Promise<Hash>;
|
|
55
|
+
/**
|
|
56
|
+
* Execute a batch of transactions
|
|
57
|
+
*/
|
|
58
|
+
executeBatch(targets: Address[], values: bigint[], datas: Hex[], options?: TransactionOptions): Promise<Hash>;
|
|
59
|
+
/**
|
|
60
|
+
* Get user's SBT balance
|
|
61
|
+
*/
|
|
62
|
+
getSBTBalance(): Promise<bigint>;
|
|
63
|
+
mintSBT(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
|
|
64
|
+
transferToken(token: Address, to: Address, amount: bigint, options?: TransactionOptions): Promise<Hash>;
|
|
65
|
+
/**
|
|
66
|
+
* Get Token Balance
|
|
67
|
+
*/
|
|
68
|
+
getTokenBalance(token: Address): Promise<bigint>;
|
|
69
|
+
stakeForRole(roleId: Hex, amount: bigint, options?: TransactionOptions): Promise<Hash>;
|
|
70
|
+
unstakeFromRole(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
|
|
71
|
+
/**
|
|
72
|
+
* Get staked balance for a specific role
|
|
73
|
+
*/
|
|
74
|
+
getStakedBalance(roleId: Hex): Promise<bigint>;
|
|
75
|
+
exitRole(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
|
|
76
|
+
leaveCommunity(community: Address, options?: TransactionOptions): Promise<Hash>;
|
|
77
|
+
/**
|
|
78
|
+
* Register as EndUser (One-click: Approve + Register)
|
|
79
|
+
* Handles GToken approval to Staking contract and Role registration.
|
|
80
|
+
*/
|
|
81
|
+
registerAsEndUser(communityAddress: Address, stakeAmount: bigint, options?: TransactionOptions): Promise<Hash>;
|
|
82
|
+
/**
|
|
83
|
+
* Execute a transaction with Gasless Sponsorship
|
|
84
|
+
*/
|
|
85
|
+
executeGasless(params: {
|
|
86
|
+
target: Address;
|
|
87
|
+
value: bigint;
|
|
88
|
+
data: Hex;
|
|
89
|
+
paymaster: Address;
|
|
90
|
+
paymasterType: 'V4' | 'Super';
|
|
91
|
+
operator?: Address;
|
|
92
|
+
maxRate?: bigint;
|
|
93
|
+
}, options?: TransactionOptions): Promise<Hash>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface CommunityClientConfig extends ClientConfig {
|
|
97
|
+
sbtAddress?: Address;
|
|
98
|
+
factoryAddress?: Address;
|
|
99
|
+
reputationAddress?: Address;
|
|
100
|
+
}
|
|
101
|
+
interface CreateCommunityParams {
|
|
102
|
+
name: string;
|
|
103
|
+
tokenSymbol: string;
|
|
104
|
+
ensName?: string;
|
|
105
|
+
description?: string;
|
|
106
|
+
}
|
|
107
|
+
interface CommunityInfo {
|
|
108
|
+
address: Address;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Client for Community Managers (`ROLE_COMMUNITY`)
|
|
112
|
+
*/
|
|
113
|
+
declare class CommunityClient extends BaseClient {
|
|
114
|
+
sbtAddress?: Address;
|
|
115
|
+
factoryAddress?: Address;
|
|
116
|
+
reputationAddress?: Address;
|
|
117
|
+
constructor(config: CommunityClientConfig);
|
|
118
|
+
/**
|
|
119
|
+
* Create a new Community Token (xPNTs) and register it.
|
|
120
|
+
* Note: In the current architecture, creating a community often involves:
|
|
121
|
+
* 1. Registering the ROLE_COMMUNITY on Registry (if not exists) -> usually manual or self-register
|
|
122
|
+
* 2. Deploying a Token (xPNTs) via Factory
|
|
123
|
+
* 3. Linking the Token to the Community in Registry
|
|
124
|
+
*/
|
|
125
|
+
createCommunityToken(params: CreateCommunityParams, options?: TransactionOptions): Promise<Hash>;
|
|
126
|
+
/**
|
|
127
|
+
* Get Community Details (Decodes Role Metadata)
|
|
128
|
+
* @param communityAddress - The address of the community manager (defaults to self)
|
|
129
|
+
*/
|
|
130
|
+
getCommunityInfo(communityAddress?: Address): Promise<{
|
|
131
|
+
name: string;
|
|
132
|
+
ensName: string;
|
|
133
|
+
website: string;
|
|
134
|
+
description: string;
|
|
135
|
+
logoURI: string;
|
|
136
|
+
stakeAmount: bigint;
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* Register self as a Community Manager.
|
|
140
|
+
* This method handles all necessary steps:
|
|
141
|
+
* 1. Checks and approves GToken to GTokenStaking
|
|
142
|
+
* 2. Encodes CommunityRoleData with provided parameters
|
|
143
|
+
* 3. Calls registerRoleSelf on Registry
|
|
144
|
+
*
|
|
145
|
+
* @param params Community registration parameters
|
|
146
|
+
* @param options Transaction options
|
|
147
|
+
* @returns Transaction hash
|
|
148
|
+
*/
|
|
149
|
+
registerAsCommunity(params: {
|
|
150
|
+
name: string;
|
|
151
|
+
ensName?: string;
|
|
152
|
+
website?: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
logoURI?: string;
|
|
155
|
+
stakeAmount?: bigint;
|
|
156
|
+
}, options?: TransactionOptions): Promise<Hash>;
|
|
157
|
+
/**
|
|
158
|
+
* One-click Setup: Register Community + Deploy Token
|
|
159
|
+
* Orchestrates the complete community initialization flow.
|
|
160
|
+
*/
|
|
161
|
+
setupCommunity(params: {
|
|
162
|
+
name: string;
|
|
163
|
+
tokenName: string;
|
|
164
|
+
tokenSymbol: string;
|
|
165
|
+
description?: string;
|
|
166
|
+
logoURI?: string;
|
|
167
|
+
website?: string;
|
|
168
|
+
stakeAmount?: bigint;
|
|
169
|
+
}, options?: TransactionOptions): Promise<{
|
|
170
|
+
tokenAddress: Address;
|
|
171
|
+
hashes: Hash[];
|
|
172
|
+
}>;
|
|
173
|
+
/**
|
|
174
|
+
* Airdrop SBTs to users to make them members
|
|
175
|
+
*/
|
|
176
|
+
airdropSBT(users: Address[], roleId: bigint, options?: TransactionOptions): Promise<Hash>;
|
|
177
|
+
setReputationRule(ruleId: bigint, ruleConfig: any, options?: TransactionOptions): Promise<Hash>;
|
|
178
|
+
/**
|
|
179
|
+
* Revoke membership (Burn SBT)
|
|
180
|
+
*/
|
|
181
|
+
revokeMembership(userAddr: Address, options?: TransactionOptions): Promise<Hash>;
|
|
182
|
+
/**
|
|
183
|
+
* Transfer ownership of the Community Token
|
|
184
|
+
*/
|
|
185
|
+
transferCommunityTokenOwnership(tokenAddress: Address, newOwner: Address, options?: TransactionOptions): Promise<Hash>;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
interface GaslessConfig {
|
|
189
|
+
paymasterUrl: string;
|
|
190
|
+
policy?: 'CREDIT' | 'TOKEN' | 'SPONSORED';
|
|
191
|
+
}
|
|
192
|
+
interface UserLifecycleConfig extends ClientConfig {
|
|
193
|
+
accountAddress: Address;
|
|
194
|
+
registryAddress: Address;
|
|
195
|
+
sbtAddress: Address;
|
|
196
|
+
gTokenAddress: Address;
|
|
197
|
+
gTokenStakingAddress: Address;
|
|
198
|
+
entryPointAddress: Address;
|
|
199
|
+
gasless?: GaslessConfig;
|
|
200
|
+
}
|
|
201
|
+
interface OnboardResult {
|
|
202
|
+
success: boolean;
|
|
203
|
+
sbtId?: bigint;
|
|
204
|
+
txHash?: Hash;
|
|
205
|
+
}
|
|
206
|
+
interface ReputationData {
|
|
207
|
+
score: bigint;
|
|
208
|
+
level: bigint;
|
|
209
|
+
creditLimit: bigint;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* UserLifecycle - L3 Pattern
|
|
213
|
+
*
|
|
214
|
+
* Responsibilities:
|
|
215
|
+
* 1. Managing the complete lifecycle of an End User (Onboard -> Operate -> Exit)
|
|
216
|
+
* 2. Providing a unified interface for Gasless operations
|
|
217
|
+
* 3. Abstracting underlying contract interactions via L2 Actions
|
|
218
|
+
*/
|
|
219
|
+
declare class UserLifecycle extends BaseClient {
|
|
220
|
+
accountAddress: Address;
|
|
221
|
+
registryAddress: Address;
|
|
222
|
+
sbtAddress: Address;
|
|
223
|
+
gTokenAddress: Address;
|
|
224
|
+
gTokenStakingAddress: Address;
|
|
225
|
+
entryPointAddress: Address;
|
|
226
|
+
gaslessConfig?: GaslessConfig;
|
|
227
|
+
config: UserLifecycleConfig;
|
|
228
|
+
constructor(config: UserLifecycleConfig);
|
|
229
|
+
/**
|
|
230
|
+
* Check if user is eligible to join a community
|
|
231
|
+
* @param community Address of the community
|
|
232
|
+
*/
|
|
233
|
+
checkEligibility(community: Address): Promise<boolean>;
|
|
234
|
+
/**
|
|
235
|
+
* One-click Onboarding: Approve -> Stake -> Register -> Mint SBT
|
|
236
|
+
* @param community Address of the community to join
|
|
237
|
+
* @param stakeAmount Amount of GToken to stake (default 0.4 GT)
|
|
238
|
+
*/
|
|
239
|
+
onboard(community: Address, stakeAmount?: bigint): Promise<OnboardResult>;
|
|
240
|
+
/**
|
|
241
|
+
* Enable or update Gasless configuration
|
|
242
|
+
*/
|
|
243
|
+
enableGasless(config: GaslessConfig): Promise<void>;
|
|
244
|
+
/**
|
|
245
|
+
* Execute a transaction effectively using Gasless configuration if available
|
|
246
|
+
*/
|
|
247
|
+
executeGaslessTx(params: {
|
|
248
|
+
target: Address;
|
|
249
|
+
value: bigint;
|
|
250
|
+
data: Hex;
|
|
251
|
+
operator?: Address;
|
|
252
|
+
}): Promise<Hash>;
|
|
253
|
+
claimSBT(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
|
|
254
|
+
getMyReputation(): Promise<ReputationData>;
|
|
255
|
+
getCreditLimit(): Promise<bigint>;
|
|
256
|
+
leaveCommunity(community: Address, options?: TransactionOptions): Promise<Hash>;
|
|
257
|
+
exitRole(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
|
|
258
|
+
unstakeAll(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export { CommunityClient, type CommunityClientConfig, type CommunityInfo, type CreateCommunityParams, type GaslessConfig, type OnboardResult, type ReputationData, UserClient, type UserClientConfig, UserLifecycle, type UserLifecycleConfig };
|
package/dist/enduser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { CommunityClient, UserLifecycle } from './chunk-
|
|
2
|
-
export { UserClient } from './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
export { CommunityClient, UserLifecycle } from './chunk-DF4WVR2H.js';
|
|
2
|
+
export { UserClient } from './chunk-MCALA6WM.js';
|
|
3
|
+
import './chunk-M5WFKETT.js';
|
|
4
|
+
import './chunk-UCLK6LTB.js';
|
|
5
5
|
import './chunk-PZ5AY32C.js';
|
|
6
6
|
//# sourceMappingURL=enduser.js.map
|
|
7
7
|
//# sourceMappingURL=enduser.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkWR4OZUXR_cjs = require('./chunk-WR4OZUXR.cjs');
|
|
4
|
+
require('./chunk-CIEYY3A6.cjs');
|
|
5
|
+
require('./chunk-MXJEULSE.cjs');
|
|
6
|
+
require('./chunk-Q7SFCCGT.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, "ReputationClient", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunkWR4OZUXR_cjs.ReputationClient; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "checkMySBT", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkWR4OZUXR_cjs.checkMySBT; }
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "getMySBTId", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunkWR4OZUXR_cjs.getMySBTId; }
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=identity.cjs.map
|
|
23
|
+
//# sourceMappingURL=identity.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"identity.cjs"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Address, Hash } from 'viem';
|
|
2
|
+
import { P as PublicClient, W as WalletClient } from './doc-types-471vSmPO.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Check if user holds MySBT token (identity verification).
|
|
6
|
+
*
|
|
7
|
+
* Does NOT swallow read errors: `balanceOf` returns 0 for a non-holder, so any
|
|
8
|
+
* thrown error is an RPC/transport/contract failure — masking it as
|
|
9
|
+
* `{ hasSBT: false }` would turn a transient RPC blip into a false "no SBT" and
|
|
10
|
+
* wrongly fail eligibility checks. The error propagates so the caller can retry
|
|
11
|
+
* or surface "couldn't determine" rather than "no SBT".
|
|
12
|
+
*/
|
|
13
|
+
declare function checkMySBT(client: any, sbtAddress: Address, user: Address): Promise<{
|
|
14
|
+
hasSBT: boolean;
|
|
15
|
+
balance: bigint;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Fetch MySBT token ID for a specific user.
|
|
19
|
+
* MySBT exposes `getUserSBT(address) -> uint256` (alias of the `userToSBT`
|
|
20
|
+
* mapping), which returns the user's tokenId or 0 when they hold no SBT.
|
|
21
|
+
*
|
|
22
|
+
* Returns the tokenId, or `null` ONLY for the genuine "no SBT" sentinel (id == 0).
|
|
23
|
+
* Read errors are NOT swallowed (see {@link checkMySBT}): a transient RPC failure
|
|
24
|
+
* must not be reported as "no SBT" (a false negative for eligibility). The error
|
|
25
|
+
* propagates to the caller.
|
|
26
|
+
*/
|
|
27
|
+
declare function getMySBTId(client: any, sbtAddress: Address, user: Address): Promise<bigint | null>;
|
|
28
|
+
|
|
29
|
+
declare class ReputationClient {
|
|
30
|
+
private client;
|
|
31
|
+
private reputationAddress;
|
|
32
|
+
/** @internal */
|
|
33
|
+
private walletClient?;
|
|
34
|
+
/**
|
|
35
|
+
* Initialize ReputationClient
|
|
36
|
+
* @param client The public client for queries
|
|
37
|
+
* @param reputationAddress The address of the reputation system contract
|
|
38
|
+
* @param walletClient Optional wallet client for write operations
|
|
39
|
+
*/
|
|
40
|
+
constructor(client: PublicClient, reputationAddress: Address, walletClient?: WalletClient);
|
|
41
|
+
/**
|
|
42
|
+
* Compute reputation score for a user
|
|
43
|
+
*/
|
|
44
|
+
computeScore(user: Address, communities: Address[], ruleIds: `0x${string}`[][], activities: bigint[][]): Promise<bigint>;
|
|
45
|
+
/**
|
|
46
|
+
* Get global reputation score for a user
|
|
47
|
+
* @param user User address
|
|
48
|
+
* @returns Reputation score
|
|
49
|
+
*/
|
|
50
|
+
getGlobalReputation(user: Address): Promise<number>;
|
|
51
|
+
/**
|
|
52
|
+
* Get credit limit based on reputation
|
|
53
|
+
* @param user User address
|
|
54
|
+
* @returns Credit limit in wei (Mock logic closely tied to Reputation)
|
|
55
|
+
*/
|
|
56
|
+
getCreditLimit(user: Address): Promise<bigint>;
|
|
57
|
+
/**
|
|
58
|
+
* Get reputation score breakdown
|
|
59
|
+
* @param user User address
|
|
60
|
+
* @returns Detailed reputation breakdown (Mock implementation awaiting contract V4)
|
|
61
|
+
*/
|
|
62
|
+
getReputationBreakdown(user: Address): Promise<{
|
|
63
|
+
baseScore: number;
|
|
64
|
+
stakingBonus: number;
|
|
65
|
+
activityBonus: number;
|
|
66
|
+
penaltyDeduction: number;
|
|
67
|
+
total: number;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Submit reputation proof (off-chain data to on-chain)
|
|
71
|
+
* @param params Proof parameters
|
|
72
|
+
* @returns Transaction hash
|
|
73
|
+
*/
|
|
74
|
+
submitReputationProof(params: {
|
|
75
|
+
proofType: 'github' | 'twitter' | 'on-chain-activity';
|
|
76
|
+
proofData: string;
|
|
77
|
+
signature: Hash;
|
|
78
|
+
}): Promise<Hash>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { ReputationClient, checkMySBT, getMySBTId };
|
package/dist/identity.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { ReputationClient, checkMySBT, getMySBTId } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { ReputationClient, checkMySBT, getMySBTId } from './chunk-KZERVPUR.js';
|
|
2
|
+
import './chunk-M5WFKETT.js';
|
|
3
|
+
import './chunk-UCLK6LTB.js';
|
|
4
4
|
import './chunk-PZ5AY32C.js';
|
|
5
5
|
//# sourceMappingURL=identity.js.map
|
|
6
6
|
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
|
|
3
|
+
type PaymasterConfig = {
|
|
4
|
+
paymasterAddress: Address;
|
|
5
|
+
operator: Address;
|
|
6
|
+
maxRate?: bigint;
|
|
7
|
+
verificationGasLimit?: bigint;
|
|
8
|
+
postOpGasLimit?: bigint;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Constructs the middleware for SuperPaymaster.
|
|
12
|
+
* Returns the `paymasterAndData` hex string.
|
|
13
|
+
*/
|
|
14
|
+
declare function getSuperPaymasterMiddleware(config: PaymasterConfig): {
|
|
15
|
+
sponsorUserOperation: (args: {
|
|
16
|
+
userOperation: any;
|
|
17
|
+
}) => Promise<{
|
|
18
|
+
paymasterAndData: `0x${string}`;
|
|
19
|
+
verificationGasLimit: bigint;
|
|
20
|
+
preVerificationGas: any;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Enhanced eligibility check for SuperPaymaster V3.
|
|
25
|
+
* Validates that user has sufficient credit with the given operator.
|
|
26
|
+
*/
|
|
27
|
+
declare function checkEligibility(client: any, paymaster: Address, user: Address, operator: Address): Promise<{
|
|
28
|
+
eligible: boolean;
|
|
29
|
+
credit?: bigint;
|
|
30
|
+
token?: Address;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Admin Client for SuperPaymaster V3
|
|
34
|
+
*/
|
|
35
|
+
declare class SuperPaymasterAdminClient {
|
|
36
|
+
private client;
|
|
37
|
+
private paymasterAddress;
|
|
38
|
+
constructor(client: any, paymasterAddress: Address);
|
|
39
|
+
getOperator(operator: Address): Promise<any>;
|
|
40
|
+
static configureOperator(wallet: any, paymaster: Address, token: Address, treasury: Address): Promise<any>;
|
|
41
|
+
static setOperatorPaused(wallet: any, paymaster: Address, operator: Address, paused: boolean): Promise<any>;
|
|
42
|
+
static updateReputation(wallet: any, paymaster: Address, operator: Address, score: bigint): Promise<any>;
|
|
43
|
+
static setAPNTsToken(wallet: any, paymaster: Address, token: Address): Promise<any>;
|
|
44
|
+
static setXPNTsFactory(wallet: any, paymaster: Address, factory: Address): Promise<any>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { type PaymasterConfig as P, SuperPaymasterAdminClient as S, checkEligibility as c, getSuperPaymasterMiddleware as g };
|