@aastar/sdk 0.24.0 → 0.24.2

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.
Files changed (105) hide show
  1. package/dist/UserClient-4MRK2D7W.cjs +15 -0
  2. package/dist/{UserClient-S6LS3CB6.cjs.map → UserClient-4MRK2D7W.cjs.map} +1 -1
  3. package/dist/UserClient-DPJ6E2XL.js +6 -0
  4. package/dist/{UserClient-KYDCMAIU.js.map → UserClient-DPJ6E2XL.js.map} +1 -1
  5. package/dist/account.cjs +7 -7
  6. package/dist/account.js +2 -2
  7. package/dist/admin.cjs +3 -3
  8. package/dist/admin.js +2 -2
  9. package/dist/airaccount.cjs +102 -102
  10. package/dist/airaccount.js +2 -2
  11. package/dist/channel.cjs +6 -6
  12. package/dist/channel.js +2 -2
  13. package/dist/{chunk-BOVDJSMK.cjs → chunk-3FRNYRWI.cjs} +26 -26
  14. package/dist/{chunk-BOVDJSMK.cjs.map → chunk-3FRNYRWI.cjs.map} +1 -1
  15. package/dist/{chunk-Y5U7URNZ.cjs → chunk-4Q6FADF6.cjs} +57 -9
  16. package/dist/chunk-4Q6FADF6.cjs.map +1 -0
  17. package/dist/{chunk-654GQ7G7.js → chunk-7FLPD3V4.js} +3 -3
  18. package/dist/{chunk-654GQ7G7.js.map → chunk-7FLPD3V4.js.map} +1 -1
  19. package/dist/{chunk-YUFQIYLR.js → chunk-BPAAWQQA.js} +52 -4
  20. package/dist/chunk-BPAAWQQA.js.map +1 -0
  21. package/dist/{chunk-BYVG7MO7.js → chunk-EEWLL7GE.js} +2 -2
  22. package/dist/{chunk-BYVG7MO7.js.map → chunk-EEWLL7GE.js.map} +1 -1
  23. package/dist/{chunk-D667CUUS.cjs → chunk-FUY4MHPM.cjs} +9 -9
  24. package/dist/{chunk-D667CUUS.cjs.map → chunk-FUY4MHPM.cjs.map} +1 -1
  25. package/dist/{chunk-HNJBQR5U.cjs → chunk-HP44S5U5.cjs} +5 -5
  26. package/dist/{chunk-HNJBQR5U.cjs.map → chunk-HP44S5U5.cjs.map} +1 -1
  27. package/dist/{chunk-MOJJ7QF6.cjs → chunk-IB3KOSHW.cjs} +2 -2
  28. package/dist/{chunk-MOJJ7QF6.cjs.map → chunk-IB3KOSHW.cjs.map} +1 -1
  29. package/dist/{chunk-VHY6R2PI.cjs → chunk-KYXXIKEI.cjs} +32 -32
  30. package/dist/{chunk-VHY6R2PI.cjs.map → chunk-KYXXIKEI.cjs.map} +1 -1
  31. package/dist/{chunk-A4ICWCHR.cjs → chunk-MANVOQY7.cjs} +5 -5
  32. package/dist/{chunk-A4ICWCHR.cjs.map → chunk-MANVOQY7.cjs.map} +1 -1
  33. package/dist/{chunk-NVYVTCHJ.cjs → chunk-MCDFQ5JH.cjs} +11 -11
  34. package/dist/{chunk-NVYVTCHJ.cjs.map → chunk-MCDFQ5JH.cjs.map} +1 -1
  35. package/dist/{chunk-7RVONA2R.js → chunk-O2CN77MV.js} +8 -8
  36. package/dist/{chunk-7RVONA2R.js.map → chunk-O2CN77MV.js.map} +1 -1
  37. package/dist/{chunk-DAMWXGKD.js → chunk-P3B6UTED.js} +3 -3
  38. package/dist/{chunk-DAMWXGKD.js.map → chunk-P3B6UTED.js.map} +1 -1
  39. package/dist/{chunk-WVJ4LQVB.js → chunk-PTVXBXZX.js} +3 -3
  40. package/dist/{chunk-WVJ4LQVB.js.map → chunk-PTVXBXZX.js.map} +1 -1
  41. package/dist/{chunk-RZ2M2RVP.js → chunk-PUE5GEKK.js} +3 -3
  42. package/dist/{chunk-RZ2M2RVP.js.map → chunk-PUE5GEKK.js.map} +1 -1
  43. package/dist/{chunk-72JZKARR.cjs → chunk-S7IUUQ5E.cjs} +6 -6
  44. package/dist/{chunk-72JZKARR.cjs.map → chunk-S7IUUQ5E.cjs.map} +1 -1
  45. package/dist/{chunk-JMW5AHLC.js → chunk-SX5GUCTF.js} +9 -9
  46. package/dist/{chunk-JMW5AHLC.js.map → chunk-SX5GUCTF.js.map} +1 -1
  47. package/dist/{chunk-5PH5CSM7.cjs → chunk-TGEVD7OR.cjs} +16 -16
  48. package/dist/{chunk-5PH5CSM7.cjs.map → chunk-TGEVD7OR.cjs.map} +1 -1
  49. package/dist/{chunk-WVOJV4Q5.cjs → chunk-TQIRRSGL.cjs} +4 -4
  50. package/dist/{chunk-WVOJV4Q5.cjs.map → chunk-TQIRRSGL.cjs.map} +1 -1
  51. package/dist/{chunk-PNBK2CLK.js → chunk-UJPW54CK.js} +3 -3
  52. package/dist/{chunk-PNBK2CLK.js.map → chunk-UJPW54CK.js.map} +1 -1
  53. package/dist/{chunk-GDH4DSVM.cjs → chunk-V23XPVHO.cjs} +12 -12
  54. package/dist/{chunk-GDH4DSVM.cjs.map → chunk-V23XPVHO.cjs.map} +1 -1
  55. package/dist/{chunk-PXQDAFXD.js → chunk-W73Y6JWZ.js} +6 -6
  56. package/dist/{chunk-PXQDAFXD.js.map → chunk-W73Y6JWZ.js.map} +1 -1
  57. package/dist/{chunk-LDARLWS3.js → chunk-XBZGVJ5K.js} +3 -3
  58. package/dist/{chunk-LDARLWS3.js.map → chunk-XBZGVJ5K.js.map} +1 -1
  59. package/dist/{chunk-WC25H5VG.js → chunk-Y5QM4LI4.js} +4 -4
  60. package/dist/{chunk-WC25H5VG.js.map → chunk-Y5QM4LI4.js.map} +1 -1
  61. package/dist/core.cjs +208 -208
  62. package/dist/core.js +1 -1
  63. package/dist/dapp.cjs +5 -5
  64. package/dist/dapp.js +2 -2
  65. package/dist/email.cjs +91 -0
  66. package/dist/email.cjs.map +1 -0
  67. package/dist/email.d.cts +115 -0
  68. package/dist/email.d.ts +115 -0
  69. package/dist/email.js +88 -0
  70. package/dist/email.js.map +1 -0
  71. package/dist/enduser.cjs +6 -6
  72. package/dist/enduser.js +3 -3
  73. package/dist/identity.cjs +5 -5
  74. package/dist/identity.js +2 -2
  75. package/dist/index.cjs +309 -309
  76. package/dist/index.js +15 -15
  77. package/dist/kms.cjs +102 -102
  78. package/dist/kms.d.cts +19 -0
  79. package/dist/kms.d.ts +19 -0
  80. package/dist/kms.js +2 -2
  81. package/dist/operator.cjs +6 -6
  82. package/dist/operator.js +2 -2
  83. package/dist/paymaster.cjs +15 -15
  84. package/dist/paymaster.js +2 -2
  85. package/dist/{src-UNS5B7FX.js → src-HKOFZ4V3.js} +4 -4
  86. package/dist/src-HKOFZ4V3.js.map +1 -0
  87. package/dist/{src-5URXSFKD.js → src-L2BLX34S.js} +3 -3
  88. package/dist/src-L2BLX34S.js.map +1 -0
  89. package/dist/{src-72GWEAPA.cjs → src-RM6DDR7K.cjs} +17 -17
  90. package/dist/src-RM6DDR7K.cjs.map +1 -0
  91. package/dist/{src-N72HAQXS.cjs → src-VO7TXJPG.cjs} +210 -210
  92. package/dist/src-VO7TXJPG.cjs.map +1 -0
  93. package/dist/tokens.cjs +3 -3
  94. package/dist/tokens.js +2 -2
  95. package/dist/x402.cjs +25 -25
  96. package/dist/x402.js +2 -2
  97. package/package.json +17 -2
  98. package/dist/UserClient-KYDCMAIU.js +0 -6
  99. package/dist/UserClient-S6LS3CB6.cjs +0 -15
  100. package/dist/chunk-Y5U7URNZ.cjs.map +0 -1
  101. package/dist/chunk-YUFQIYLR.js.map +0 -1
  102. package/dist/src-5URXSFKD.js.map +0 -1
  103. package/dist/src-72GWEAPA.cjs.map +0 -1
  104. package/dist/src-N72HAQXS.cjs.map +0 -1
  105. package/dist/src-UNS5B7FX.js.map +0 -1
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- export { AASTAR_COMMUNITY, AAStarAirAccountFactoryV7ABI, AAStarAirAccountFactoryV7Artifact, AAStarAirAccountV7ABI, AAStarAirAccountV7Artifact, AAStarBLSAggregatorABI, AAStarBLSAggregatorArtifact, AAStarBLSAlgorithmABI, AAStarBLSAlgorithmArtifact, AAStarValidatorABI, AAStarValidatorArtifact, ALG_BLS, ALL_ROLES, AgentRegistryABI, AgentRegistryArtifact, AirAccountDelegateABI, AirAccountDelegateArtifact, AirAccountExtensionABI, AirAccountExtensionArtifact, AuthorizationState, BLSAggregatorABI, BLSAggregatorArtifact, BLSHelpers, BLSSigner, BLSValidatorABI, BLSValidatorArtifact, BLS_POP_DST, BRANDING, BREAD_COMMUNITY, BaseClient, BundlerClient, COMMUNITIES, CONTRACTS, CONTRACT_METADATA, CalldataParserRegistryABI, CalldataParserRegistryArtifact, ContractConfigManager, DEFAULT_ADMIN_ROLE, DEFAULT_DVT_NODES, DVTValidatorABI, DVTValidatorArtifact, DVT_TIER_T2, DVT_TIER_T3, EntryPointABI, EntryPointArtifact, EntryPointVersion, ForceExitModuleABI, ForceExitModuleArtifact, GTokenABI, GTokenArtifact, GTokenAuthorizationABI, GTokenAuthorizationArtifact, GTokenStakingABI, GTokenStakingArtifact, GUARDIAN_ADDITION_NONCE_SLOT, GUARDIAN_REMOVAL_NONCE_SLOT, GUARDIAN_SIG_VERSION, INITIAL_ROLE_STAKES, INLINE_ALG_IDS, LINKS, MAX_GUARDIAN_SLOT, MicroPaymentChannelABI, MicroPaymentChannelArtifact, MySBTABI, MySBTArtifact, NETWORKS, NodeType, P256_GUARDIAN_DOMAIN, P256_GUARDIAN_SENTINEL, PaymasterABI, PaymasterArtifact, PaymasterFactoryABI, PaymasterFactoryArtifact, PolicyDecision, PolicyRegistryABI, PolicyRegistryArtifact, RECOVERY_NONCE_SLOT, ROLE_ANODE, ROLE_COMMUNITY, ROLE_DVT, ROLE_ENDUSER, ROLE_KMS, ROLE_NAMES, ROLE_PAYMASTER_AOA, ROLE_PAYMASTER_SUPER, ROLE_PERMISSION_LEVELS, RegistryABI, RegistryArtifact, ReputationSystemABI, ReputationSystemArtifact, RequirementChecker, RolePermissionLevel, SECP256R1_N, SECP256R1_N_OVER_2, SEPOLIA_CONTRACTS, SEPOLIA_V2_VERSIONS, SepoliaFaucetAPI, SessionKeyValidatorABI, SessionKeyValidatorArtifact, SimpleAccountABI, SimpleAccountArtifact, SimpleAccountFactoryABI, SimpleAccountFactoryArtifact, StateValidator, SuperPaymasterABI, SuperPaymasterArtifact, TIER_LIMIT_NONCE_SLOT, V2_SUMMARY, WEBAUTHN_GET_CHALLENGE_PREFIX, X402FacilitatorABI, X402FacilitatorArtifact, accountActions, accountFactoryActions, agentActions, agentRegistryActions, aggregatorActions, airAccountActions, airAccountExtensionActions, airAccountFactoryActions, base64UrlEncode, blsAlgorithmActions, buildAddGuardianChallenge, buildAddP256GuardianChallenge, buildApproveRecoveryChallenge, buildCancelRecoveryChallenge, buildInitConfig, buildModifyTierLimitsChallenge, buildP256GuardianChallenge, buildProposeRecoveryChallenge, buildRemoveGuardianChallenge, channelActions, coseToP256XY, createAAStarPublicClient, createHeliosTransport, decodeWebAuthnAssertion, dvtActions, encodeBLSAccountSignature, encodeDVTAccountSignature, encodeDVTVerifierProof, encodeG2Point, encodeWebAuthnAssertion, entryPointActions, forceExitActions, gTokenActions, gTokenAuthorizationActions, getAddressUrl, getAllCommunityConfigs, getAllV2Contracts, getBlockExplorer, getChainId, getCommunities, getCommunity, getCommunityConfig, getContract, getContractNetworks, getContracts, getCoreContracts, getDefaultDvtNodes, getDeploymentDate, getEntryPoint, getNetwork, getPaymasterV4_1, getRoleName, getRpcUrl, getSimpleAccountFactory, getSuperPaymasterV2, getTestAccounts, getTestTokenContracts, getTokenContracts, getTxUrl, getV2ContractByAddress, getV2ContractByName, getV2ContractsByDate, hashToFieldU0U1, isContractNetworkSupported, isRegisteredCommunity, isV2Contract, lookupAddress, needsValidatorRouter, opDataAddGuardian, opDataAddP256Guardian, opDataModifyTierLimits, opDataRecovery, opDataRemoveGuardian, p256GuardianPublicKey, paymasterActions, paymasterFactoryActions, policyRegistryActions, registryActions, reputationActions, resolveEns, resolveEnsVerified, sbtActions, sessionKeyValidatorActions, signP256GuardianAssertion, stakingActions, superPaymasterActions, tokenActions, x402Actions, x402IsNonceUsed, x402NonceKey, xPNTsFactoryABI, xPNTsFactoryActions, xPNTsFactoryArtifact, xPNTsTokenABI, xPNTsTokenActions, xPNTsTokenArtifact } from './chunk-BYVG7MO7.js';
1
+ export { AASTAR_COMMUNITY, AAStarAirAccountFactoryV7ABI, AAStarAirAccountFactoryV7Artifact, AAStarAirAccountV7ABI, AAStarAirAccountV7Artifact, AAStarBLSAggregatorABI, AAStarBLSAggregatorArtifact, AAStarBLSAlgorithmABI, AAStarBLSAlgorithmArtifact, AAStarValidatorABI, AAStarValidatorArtifact, ALG_BLS, ALL_ROLES, AgentRegistryABI, AgentRegistryArtifact, AirAccountDelegateABI, AirAccountDelegateArtifact, AirAccountExtensionABI, AirAccountExtensionArtifact, AuthorizationState, BLSAggregatorABI, BLSAggregatorArtifact, BLSHelpers, BLSSigner, BLSValidatorABI, BLSValidatorArtifact, BLS_POP_DST, BRANDING, BREAD_COMMUNITY, BaseClient, BundlerClient, COMMUNITIES, CONTRACTS, CONTRACT_METADATA, CalldataParserRegistryABI, CalldataParserRegistryArtifact, ContractConfigManager, DEFAULT_ADMIN_ROLE, DEFAULT_DVT_NODES, DVTValidatorABI, DVTValidatorArtifact, DVT_TIER_T2, DVT_TIER_T3, EntryPointABI, EntryPointArtifact, EntryPointVersion, ForceExitModuleABI, ForceExitModuleArtifact, GTokenABI, GTokenArtifact, GTokenAuthorizationABI, GTokenAuthorizationArtifact, GTokenStakingABI, GTokenStakingArtifact, GUARDIAN_ADDITION_NONCE_SLOT, GUARDIAN_REMOVAL_NONCE_SLOT, GUARDIAN_SIG_VERSION, INITIAL_ROLE_STAKES, INLINE_ALG_IDS, LINKS, MAX_GUARDIAN_SLOT, MicroPaymentChannelABI, MicroPaymentChannelArtifact, MySBTABI, MySBTArtifact, NETWORKS, NodeType, P256_GUARDIAN_DOMAIN, P256_GUARDIAN_SENTINEL, PaymasterABI, PaymasterArtifact, PaymasterFactoryABI, PaymasterFactoryArtifact, PolicyDecision, PolicyRegistryABI, PolicyRegistryArtifact, RECOVERY_NONCE_SLOT, ROLE_ANODE, ROLE_COMMUNITY, ROLE_DVT, ROLE_ENDUSER, ROLE_KMS, ROLE_NAMES, ROLE_PAYMASTER_AOA, ROLE_PAYMASTER_SUPER, ROLE_PERMISSION_LEVELS, RegistryABI, RegistryArtifact, ReputationSystemABI, ReputationSystemArtifact, RequirementChecker, RolePermissionLevel, SECP256R1_N, SECP256R1_N_OVER_2, SEPOLIA_CONTRACTS, SEPOLIA_V2_VERSIONS, SepoliaFaucetAPI, SessionKeyValidatorABI, SessionKeyValidatorArtifact, SimpleAccountABI, SimpleAccountArtifact, SimpleAccountFactoryABI, SimpleAccountFactoryArtifact, StateValidator, SuperPaymasterABI, SuperPaymasterArtifact, TIER_LIMIT_NONCE_SLOT, V2_SUMMARY, WEBAUTHN_GET_CHALLENGE_PREFIX, X402FacilitatorABI, X402FacilitatorArtifact, accountActions, accountFactoryActions, agentActions, agentRegistryActions, aggregatorActions, airAccountActions, airAccountExtensionActions, airAccountFactoryActions, base64UrlEncode, blsAlgorithmActions, buildAddGuardianChallenge, buildAddP256GuardianChallenge, buildApproveRecoveryChallenge, buildCancelRecoveryChallenge, buildInitConfig, buildModifyTierLimitsChallenge, buildP256GuardianChallenge, buildProposeRecoveryChallenge, buildRemoveGuardianChallenge, channelActions, coseToP256XY, createAAStarPublicClient, createHeliosTransport, decodeWebAuthnAssertion, dvtActions, encodeBLSAccountSignature, encodeDVTAccountSignature, encodeDVTVerifierProof, encodeG2Point, encodeWebAuthnAssertion, entryPointActions, forceExitActions, gTokenActions, gTokenAuthorizationActions, getAddressUrl, getAllCommunityConfigs, getAllV2Contracts, getBlockExplorer, getChainId, getCommunities, getCommunity, getCommunityConfig, getContract, getContractNetworks, getContracts, getCoreContracts, getDefaultDvtNodes, getDeploymentDate, getEntryPoint, getNetwork, getPaymasterV4_1, getRoleName, getRpcUrl, getSimpleAccountFactory, getSuperPaymasterV2, getTestAccounts, getTestTokenContracts, getTokenContracts, getTxUrl, getV2ContractByAddress, getV2ContractByName, getV2ContractsByDate, hashToFieldU0U1, isContractNetworkSupported, isRegisteredCommunity, isV2Contract, lookupAddress, needsValidatorRouter, opDataAddGuardian, opDataAddP256Guardian, opDataModifyTierLimits, opDataRecovery, opDataRemoveGuardian, p256GuardianPublicKey, paymasterActions, paymasterFactoryActions, policyRegistryActions, registryActions, reputationActions, resolveEns, resolveEnsVerified, sbtActions, sessionKeyValidatorActions, signP256GuardianAssertion, stakingActions, superPaymasterActions, tokenActions, x402Actions, x402IsNonceUsed, x402NonceKey, xPNTsFactoryABI, xPNTsFactoryActions, xPNTsFactoryArtifact, xPNTsTokenABI, xPNTsTokenActions, xPNTsTokenArtifact } from './chunk-EEWLL7GE.js';
2
2
  export { AGENT_IDENTITY_REGISTRY_ADDRESS, AGENT_REPUTATION_REGISTRY_ADDRESS, ALL_ADDRESSES, APNTS_ADDRESS, BLS_AGGREGATOR_ADDRESS, BLS_VALIDATOR_ADDRESS, BPS_DENOMINATOR, CANONICAL_ADDRESSES, CHAIN_MAINNET, CHAIN_SEPOLIA, COMMUNITY_OWNERS, CONTRACT_SRC_HASH, CORE_ADDRESSES, DEFAULT_APNTS_PRICE_USD, DEFAULT_CALL_GAS_LIMIT, DEFAULT_GAS_TOKEN_MINT_AMOUNT, DEFAULT_PRE_VERIFICATION_GAS, DEFAULT_TIMEOUT_MS, DEFAULT_TOKEN_NAME, DEFAULT_TOKEN_SYMBOL, DEFAULT_USDT_MINT_AMOUNT, DEFAULT_VERIFICATION_GAS_LIMIT, DVT_VALIDATOR_ADDRESS, ENTRY_POINT_ADDRESS, FAUCET_API_URL, GTOKEN_ADDRESS, GTOKEN_STAKING_ADDRESS, MAX_SERVICE_FEE, MICRO_PAYMENT_CHANNEL_ADDRESS, MONITORING_ADDRESSES, NODE_STAKE_AMOUNTS, OFFICIAL_ADDRESSES, PAYMASTER_ADDRESSES, PAYMASTER_FACTORY_ADDRESS, PAYMASTER_V4_ADDRESS, PAYMASTER_V4_IMPL_ADDRESS, REGISTRY_ADDRESS, REPUTATION_SYSTEM_ADDRESS, SBT_ADDRESS, SERVICE_FEE_RATE, SUPER_PAYMASTER_ADDRESS, TEST_ACCOUNT_ADDRESSES, TEST_ACCOUNT_POOL_SIZE, TEST_COMMUNITIES, TEST_TOKEN_ADDRESSES, TOKEN_ADDRESSES, XPNTS_FACTORY_ADDRESS, applyConfig, describeSupportedChains, getCanonicalAddresses, isSupportedChainId, listSupportedChainIds } from './chunk-UCLK6LTB.js';
3
3
  import './chunk-PZ5AY32C.js';
4
4
  //# sourceMappingURL=core.js.map
package/dist/dapp.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkNVYVTCHJ_cjs = require('./chunk-NVYVTCHJ.cjs');
4
- var chunkMOJJ7QF6_cjs = require('./chunk-MOJJ7QF6.cjs');
3
+ var chunkMCDFQ5JH_cjs = require('./chunk-MCDFQ5JH.cjs');
4
+ var chunkIB3KOSHW_cjs = require('./chunk-IB3KOSHW.cjs');
5
5
  require('./chunk-MXJEULSE.cjs');
6
6
  require('./chunk-Q7SFCCGT.cjs');
7
7
  var viem = require('viem');
@@ -32,10 +32,10 @@ function useCreditScore({ chain, rpcUrl, registryAddress, userAddress }) {
32
32
  const fetchCredit = async () => {
33
33
  setLoading(true);
34
34
  try {
35
- const client = chunkMOJJ7QF6_cjs.createAAStarPublicClient(rpcUrl, chain);
35
+ const client = chunkIB3KOSHW_cjs.createAAStarPublicClient(rpcUrl, chain);
36
36
  const limit = await client.readContract({
37
37
  address: registryAddress,
38
- abi: chunkMOJJ7QF6_cjs.RegistryABI,
38
+ abi: chunkIB3KOSHW_cjs.RegistryABI,
39
39
  functionName: "getCreditLimit",
40
40
  args: [userAddress]
41
41
  });
@@ -58,7 +58,7 @@ function useSuperPaymaster(config) {
58
58
  setIsLoading(true);
59
59
  setError(null);
60
60
  try {
61
- const middleware = chunkNVYVTCHJ_cjs.getSuperPaymasterMiddleware(config);
61
+ const middleware = chunkMCDFQ5JH_cjs.getSuperPaymasterMiddleware(config);
62
62
  const result = await middleware.sponsorUserOperation({ userOperation: userOp });
63
63
  return result.paymasterAndData;
64
64
  } catch (err) {
package/dist/dapp.js CHANGED
@@ -1,5 +1,5 @@
1
- import { getSuperPaymasterMiddleware } from './chunk-LDARLWS3.js';
2
- import { createAAStarPublicClient, RegistryABI } from './chunk-BYVG7MO7.js';
1
+ import { getSuperPaymasterMiddleware } from './chunk-XBZGVJ5K.js';
2
+ import { createAAStarPublicClient, RegistryABI } from './chunk-EEWLL7GE.js';
3
3
  import './chunk-UCLK6LTB.js';
4
4
  import './chunk-PZ5AY32C.js';
5
5
  import { parseAbi, createPublicClient, http, hashTypedData, hashMessage, hexToBytes, encodeFunctionData } from 'viem';
package/dist/email.cjs ADDED
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ require('./chunk-Q7SFCCGT.cjs');
4
+ var resend = require('resend');
5
+
6
+ var BatchSendError = class extends Error {
7
+ constructor(message, failures) {
8
+ super(message);
9
+ this.failures = failures;
10
+ this.name = "BatchSendError";
11
+ }
12
+ };
13
+ function toResendPayload(options) {
14
+ return options;
15
+ }
16
+ var ResendMailer = class _ResendMailer {
17
+ client;
18
+ /** @param apiKey - Resend API key from https://resend.com/api-keys */
19
+ constructor(apiKey) {
20
+ if (!apiKey) {
21
+ throw new Error("Resend API key is required. Get yours at https://resend.com/api-keys");
22
+ }
23
+ this.client = new resend.Resend(apiKey);
24
+ }
25
+ /**
26
+ * Send a single email.
27
+ * @returns `{ id }` — Resend email ID for delivery status queries
28
+ */
29
+ async send(options) {
30
+ const { idempotencyKey, ...emailOptions } = options;
31
+ const { data, error } = await this.client.emails.send(
32
+ toResendPayload(emailOptions),
33
+ idempotencyKey ? { idempotencyKey } : void 0
34
+ );
35
+ if (error) throw new Error(`Failed to send email: ${error.message}`);
36
+ if (!data?.id) throw new Error("Resend returned no email ID");
37
+ return { id: data.id };
38
+ }
39
+ /**
40
+ * Send a batch of emails (max 100 per request).
41
+ * `idempotencyKey` is stripped per item — not supported by the batch endpoint.
42
+ *
43
+ * @throws {BatchSendError} if any item is missing an ID in the response
44
+ * @returns Results in the same order as the input
45
+ */
46
+ async sendBatch(emails) {
47
+ if (emails.length === 0) return [];
48
+ if (emails.length > 100) {
49
+ throw new Error("sendBatch supports at most 100 emails per request");
50
+ }
51
+ const payload = emails.map(({ idempotencyKey: _, ...rest }) => toResendPayload(rest));
52
+ const { data, error } = await this.client.batch.send(payload);
53
+ if (error) throw new Error(`Failed to send batch emails: ${error.message}`);
54
+ const results = data ?? [];
55
+ const failures = [];
56
+ const successes = [];
57
+ results.forEach((item, index) => {
58
+ if (!item?.id) {
59
+ failures.push({ index, reason: "No email ID returned for this item" });
60
+ } else {
61
+ successes.push({ index, id: item.id });
62
+ }
63
+ });
64
+ if (failures.length > 0) {
65
+ throw new BatchSendError(
66
+ `sendBatch: ${failures.length} of ${emails.length} emails failed`,
67
+ failures
68
+ );
69
+ }
70
+ return successes;
71
+ }
72
+ /**
73
+ * Create a ResendMailer from the `RESEND_API_KEY` environment variable.
74
+ * Recommended for server-side and CI usage.
75
+ * @throws if the environment variable is not set
76
+ */
77
+ static fromEnv() {
78
+ const key = process.env.RESEND_API_KEY;
79
+ if (!key) {
80
+ throw new Error(
81
+ 'RESEND_API_KEY environment variable is not set. Pass the key directly: new ResendMailer("re_...")'
82
+ );
83
+ }
84
+ return new _ResendMailer(key);
85
+ }
86
+ };
87
+
88
+ exports.BatchSendError = BatchSendError;
89
+ exports.ResendMailer = ResendMailer;
90
+ //# sourceMappingURL=email.cjs.map
91
+ //# sourceMappingURL=email.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../email/src/mailer.ts"],"names":["Resend"],"mappings":";;;;;AAkDO,IAAM,cAAA,GAAN,cAA6B,KAAA,CAAM;AAAA,EACxC,WAAA,CACE,SACgB,QAAA,EAChB;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAFG,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AAGhB,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AAAA,EACd;AACF;AAEA,SAAS,gBAAgB,OAAA,EAAkE;AACzF,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end';\nimport type { CreateEmailOptions } from 'resend';\n\n/**\n * Options for sending a single email or one item in a batch.\n */\nexport interface MailOptions {\n /**\n * Sender address.\n * - Custom domains (e.g. `hi@aastar.io`) must be verified in the Resend dashboard\n * (SPF/DKIM/DMARC DNS records) before use.\n * - Without domain verification, use `onboarding@resend.dev` (test only).\n */\n from: string;\n to: string | string[];\n subject: string;\n html?: string;\n text?: string;\n cc?: string | string[];\n bcc?: string | string[];\n replyTo?: string;\n attachments?: Array<{ filename: string; content: Buffer | string }>;\n headers?: Record<string, string>;\n tags?: Array<{ name: string; value: string }>;\n /**\n * ISO 8601 datetime with timezone offset for scheduled delivery.\n * Example: `\"2026-06-01T09:00:00+07:00\"` or `\"2026-06-01T02:00:00Z\"`.\n * Must be a future timestamp; Resend rejects past or timezone-ambiguous values.\n */\n scheduledAt?: string;\n /**\n * Idempotency key for agent retry scenarios.\n * Duplicate calls with the same key will not send the email again.\n * Only supported by `send()` — ignored by `sendBatch()`.\n */\n idempotencyKey?: string;\n}\n\n/** Result of a successful single send or one item in a batch result. */\nexport interface SendResult {\n id: string;\n}\n\n/** Per-item result for sendBatch — includes index for error attribution. */\nexport interface BatchSendResult {\n index: number;\n id: string;\n}\n\n/** Error thrown when one or more batch items fail. */\nexport class BatchSendError extends Error {\n constructor(\n message: string,\n public readonly failures: Array<{ index: number; reason: string }>,\n ) {\n super(message);\n this.name = 'BatchSendError';\n }\n}\n\nfunction toResendPayload(options: Omit<MailOptions, 'idempotencyKey'>): CreateEmailOptions {\n return options as unknown as CreateEmailOptions;\n}\n\n/**\n * ResendMailer — server-side email utility built on the Resend API.\n *\n * Install: `pnpm add @aastar/email`\n *\n * @example\n * ```ts\n * import { ResendMailer } from '@aastar/email';\n *\n * const mailer = ResendMailer.fromEnv(); // reads RESEND_API_KEY\n * await mailer.send({\n * from: 'hi@aastar.io',\n * to: 'user@example.com',\n * subject: 'Welcome',\n * html: '<h1>Hello!</h1>',\n * });\n * ```\n *\n * @example Agent tool with idempotency\n * ```ts\n * await mailer.send({\n * from: 'hi@aastar.io',\n * to: 'user@example.com',\n * subject: 'Your receipt',\n * html: '...',\n * idempotencyKey: `receipt-${txHash}`,\n * });\n * ```\n */\nexport class ResendMailer {\n private client: Resend;\n\n /** @param apiKey - Resend API key from https://resend.com/api-keys */\n constructor(apiKey: string) {\n if (!apiKey) {\n throw new Error('Resend API key is required. Get yours at https://resend.com/api-keys');\n }\n this.client = new Resend(apiKey);\n }\n\n /**\n * Send a single email.\n * @returns `{ id }` — Resend email ID for delivery status queries\n */\n async send(options: MailOptions): Promise<SendResult> {\n const { idempotencyKey, ...emailOptions } = options;\n const { data, error } = await this.client.emails.send(\n toResendPayload(emailOptions),\n idempotencyKey ? { idempotencyKey } : undefined,\n );\n if (error) throw new Error(`Failed to send email: ${error.message}`);\n if (!data?.id) throw new Error('Resend returned no email ID');\n return { id: data.id };\n }\n\n /**\n * Send a batch of emails (max 100 per request).\n * `idempotencyKey` is stripped per item — not supported by the batch endpoint.\n *\n * @throws {BatchSendError} if any item is missing an ID in the response\n * @returns Results in the same order as the input\n */\n async sendBatch(emails: MailOptions[]): Promise<BatchSendResult[]> {\n if (emails.length === 0) return [];\n if (emails.length > 100) {\n throw new Error('sendBatch supports at most 100 emails per request');\n }\n\n const payload = emails.map(({ idempotencyKey: _, ...rest }) => toResendPayload(rest));\n const { data, error } = await this.client.batch.send(payload);\n\n if (error) throw new Error(`Failed to send batch emails: ${error.message}`);\n\n const results = (data as unknown as Array<{ id?: string }>) ?? [];\n const failures: Array<{ index: number; reason: string }> = [];\n const successes: BatchSendResult[] = [];\n\n results.forEach((item: { id?: string }, index: number) => {\n if (!item?.id) {\n failures.push({ index, reason: 'No email ID returned for this item' });\n } else {\n successes.push({ index, id: item.id });\n }\n });\n\n if (failures.length > 0) {\n throw new BatchSendError(\n `sendBatch: ${failures.length} of ${emails.length} emails failed`,\n failures,\n );\n }\n\n return successes;\n }\n\n /**\n * Create a ResendMailer from the `RESEND_API_KEY` environment variable.\n * Recommended for server-side and CI usage.\n * @throws if the environment variable is not set\n */\n static fromEnv(): ResendMailer {\n const key = process.env.RESEND_API_KEY;\n if (!key) {\n throw new Error(\n 'RESEND_API_KEY environment variable is not set. Pass the key directly: new ResendMailer(\"re_...\")',\n );\n }\n return new ResendMailer(key);\n }\n}\n"]}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Options for sending a single email or one item in a batch.
3
+ */
4
+ interface MailOptions {
5
+ /**
6
+ * Sender address.
7
+ * - Custom domains (e.g. `hi@aastar.io`) must be verified in the Resend dashboard
8
+ * (SPF/DKIM/DMARC DNS records) before use.
9
+ * - Without domain verification, use `onboarding@resend.dev` (test only).
10
+ */
11
+ from: string;
12
+ to: string | string[];
13
+ subject: string;
14
+ html?: string;
15
+ text?: string;
16
+ cc?: string | string[];
17
+ bcc?: string | string[];
18
+ replyTo?: string;
19
+ attachments?: Array<{
20
+ filename: string;
21
+ content: Buffer | string;
22
+ }>;
23
+ headers?: Record<string, string>;
24
+ tags?: Array<{
25
+ name: string;
26
+ value: string;
27
+ }>;
28
+ /**
29
+ * ISO 8601 datetime with timezone offset for scheduled delivery.
30
+ * Example: `"2026-06-01T09:00:00+07:00"` or `"2026-06-01T02:00:00Z"`.
31
+ * Must be a future timestamp; Resend rejects past or timezone-ambiguous values.
32
+ */
33
+ scheduledAt?: string;
34
+ /**
35
+ * Idempotency key for agent retry scenarios.
36
+ * Duplicate calls with the same key will not send the email again.
37
+ * Only supported by `send()` — ignored by `sendBatch()`.
38
+ */
39
+ idempotencyKey?: string;
40
+ }
41
+ /** Result of a successful single send or one item in a batch result. */
42
+ interface SendResult {
43
+ id: string;
44
+ }
45
+ /** Per-item result for sendBatch — includes index for error attribution. */
46
+ interface BatchSendResult {
47
+ index: number;
48
+ id: string;
49
+ }
50
+ /** Error thrown when one or more batch items fail. */
51
+ declare class BatchSendError extends Error {
52
+ readonly failures: Array<{
53
+ index: number;
54
+ reason: string;
55
+ }>;
56
+ constructor(message: string, failures: Array<{
57
+ index: number;
58
+ reason: string;
59
+ }>);
60
+ }
61
+ /**
62
+ * ResendMailer — server-side email utility built on the Resend API.
63
+ *
64
+ * Install: `pnpm add @aastar/email`
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * import { ResendMailer } from '@aastar/email';
69
+ *
70
+ * const mailer = ResendMailer.fromEnv(); // reads RESEND_API_KEY
71
+ * await mailer.send({
72
+ * from: 'hi@aastar.io',
73
+ * to: 'user@example.com',
74
+ * subject: 'Welcome',
75
+ * html: '<h1>Hello!</h1>',
76
+ * });
77
+ * ```
78
+ *
79
+ * @example Agent tool with idempotency
80
+ * ```ts
81
+ * await mailer.send({
82
+ * from: 'hi@aastar.io',
83
+ * to: 'user@example.com',
84
+ * subject: 'Your receipt',
85
+ * html: '...',
86
+ * idempotencyKey: `receipt-${txHash}`,
87
+ * });
88
+ * ```
89
+ */
90
+ declare class ResendMailer {
91
+ private client;
92
+ /** @param apiKey - Resend API key from https://resend.com/api-keys */
93
+ constructor(apiKey: string);
94
+ /**
95
+ * Send a single email.
96
+ * @returns `{ id }` — Resend email ID for delivery status queries
97
+ */
98
+ send(options: MailOptions): Promise<SendResult>;
99
+ /**
100
+ * Send a batch of emails (max 100 per request).
101
+ * `idempotencyKey` is stripped per item — not supported by the batch endpoint.
102
+ *
103
+ * @throws {BatchSendError} if any item is missing an ID in the response
104
+ * @returns Results in the same order as the input
105
+ */
106
+ sendBatch(emails: MailOptions[]): Promise<BatchSendResult[]>;
107
+ /**
108
+ * Create a ResendMailer from the `RESEND_API_KEY` environment variable.
109
+ * Recommended for server-side and CI usage.
110
+ * @throws if the environment variable is not set
111
+ */
112
+ static fromEnv(): ResendMailer;
113
+ }
114
+
115
+ export { BatchSendError, type BatchSendResult, type MailOptions, ResendMailer, type SendResult };
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Options for sending a single email or one item in a batch.
3
+ */
4
+ interface MailOptions {
5
+ /**
6
+ * Sender address.
7
+ * - Custom domains (e.g. `hi@aastar.io`) must be verified in the Resend dashboard
8
+ * (SPF/DKIM/DMARC DNS records) before use.
9
+ * - Without domain verification, use `onboarding@resend.dev` (test only).
10
+ */
11
+ from: string;
12
+ to: string | string[];
13
+ subject: string;
14
+ html?: string;
15
+ text?: string;
16
+ cc?: string | string[];
17
+ bcc?: string | string[];
18
+ replyTo?: string;
19
+ attachments?: Array<{
20
+ filename: string;
21
+ content: Buffer | string;
22
+ }>;
23
+ headers?: Record<string, string>;
24
+ tags?: Array<{
25
+ name: string;
26
+ value: string;
27
+ }>;
28
+ /**
29
+ * ISO 8601 datetime with timezone offset for scheduled delivery.
30
+ * Example: `"2026-06-01T09:00:00+07:00"` or `"2026-06-01T02:00:00Z"`.
31
+ * Must be a future timestamp; Resend rejects past or timezone-ambiguous values.
32
+ */
33
+ scheduledAt?: string;
34
+ /**
35
+ * Idempotency key for agent retry scenarios.
36
+ * Duplicate calls with the same key will not send the email again.
37
+ * Only supported by `send()` — ignored by `sendBatch()`.
38
+ */
39
+ idempotencyKey?: string;
40
+ }
41
+ /** Result of a successful single send or one item in a batch result. */
42
+ interface SendResult {
43
+ id: string;
44
+ }
45
+ /** Per-item result for sendBatch — includes index for error attribution. */
46
+ interface BatchSendResult {
47
+ index: number;
48
+ id: string;
49
+ }
50
+ /** Error thrown when one or more batch items fail. */
51
+ declare class BatchSendError extends Error {
52
+ readonly failures: Array<{
53
+ index: number;
54
+ reason: string;
55
+ }>;
56
+ constructor(message: string, failures: Array<{
57
+ index: number;
58
+ reason: string;
59
+ }>);
60
+ }
61
+ /**
62
+ * ResendMailer — server-side email utility built on the Resend API.
63
+ *
64
+ * Install: `pnpm add @aastar/email`
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * import { ResendMailer } from '@aastar/email';
69
+ *
70
+ * const mailer = ResendMailer.fromEnv(); // reads RESEND_API_KEY
71
+ * await mailer.send({
72
+ * from: 'hi@aastar.io',
73
+ * to: 'user@example.com',
74
+ * subject: 'Welcome',
75
+ * html: '<h1>Hello!</h1>',
76
+ * });
77
+ * ```
78
+ *
79
+ * @example Agent tool with idempotency
80
+ * ```ts
81
+ * await mailer.send({
82
+ * from: 'hi@aastar.io',
83
+ * to: 'user@example.com',
84
+ * subject: 'Your receipt',
85
+ * html: '...',
86
+ * idempotencyKey: `receipt-${txHash}`,
87
+ * });
88
+ * ```
89
+ */
90
+ declare class ResendMailer {
91
+ private client;
92
+ /** @param apiKey - Resend API key from https://resend.com/api-keys */
93
+ constructor(apiKey: string);
94
+ /**
95
+ * Send a single email.
96
+ * @returns `{ id }` — Resend email ID for delivery status queries
97
+ */
98
+ send(options: MailOptions): Promise<SendResult>;
99
+ /**
100
+ * Send a batch of emails (max 100 per request).
101
+ * `idempotencyKey` is stripped per item — not supported by the batch endpoint.
102
+ *
103
+ * @throws {BatchSendError} if any item is missing an ID in the response
104
+ * @returns Results in the same order as the input
105
+ */
106
+ sendBatch(emails: MailOptions[]): Promise<BatchSendResult[]>;
107
+ /**
108
+ * Create a ResendMailer from the `RESEND_API_KEY` environment variable.
109
+ * Recommended for server-side and CI usage.
110
+ * @throws if the environment variable is not set
111
+ */
112
+ static fromEnv(): ResendMailer;
113
+ }
114
+
115
+ export { BatchSendError, type BatchSendResult, type MailOptions, ResendMailer, type SendResult };
package/dist/email.js ADDED
@@ -0,0 +1,88 @@
1
+ import './chunk-PZ5AY32C.js';
2
+ import { Resend } from 'resend';
3
+
4
+ var BatchSendError = class extends Error {
5
+ constructor(message, failures) {
6
+ super(message);
7
+ this.failures = failures;
8
+ this.name = "BatchSendError";
9
+ }
10
+ };
11
+ function toResendPayload(options) {
12
+ return options;
13
+ }
14
+ var ResendMailer = class _ResendMailer {
15
+ client;
16
+ /** @param apiKey - Resend API key from https://resend.com/api-keys */
17
+ constructor(apiKey) {
18
+ if (!apiKey) {
19
+ throw new Error("Resend API key is required. Get yours at https://resend.com/api-keys");
20
+ }
21
+ this.client = new Resend(apiKey);
22
+ }
23
+ /**
24
+ * Send a single email.
25
+ * @returns `{ id }` — Resend email ID for delivery status queries
26
+ */
27
+ async send(options) {
28
+ const { idempotencyKey, ...emailOptions } = options;
29
+ const { data, error } = await this.client.emails.send(
30
+ toResendPayload(emailOptions),
31
+ idempotencyKey ? { idempotencyKey } : void 0
32
+ );
33
+ if (error) throw new Error(`Failed to send email: ${error.message}`);
34
+ if (!data?.id) throw new Error("Resend returned no email ID");
35
+ return { id: data.id };
36
+ }
37
+ /**
38
+ * Send a batch of emails (max 100 per request).
39
+ * `idempotencyKey` is stripped per item — not supported by the batch endpoint.
40
+ *
41
+ * @throws {BatchSendError} if any item is missing an ID in the response
42
+ * @returns Results in the same order as the input
43
+ */
44
+ async sendBatch(emails) {
45
+ if (emails.length === 0) return [];
46
+ if (emails.length > 100) {
47
+ throw new Error("sendBatch supports at most 100 emails per request");
48
+ }
49
+ const payload = emails.map(({ idempotencyKey: _, ...rest }) => toResendPayload(rest));
50
+ const { data, error } = await this.client.batch.send(payload);
51
+ if (error) throw new Error(`Failed to send batch emails: ${error.message}`);
52
+ const results = data ?? [];
53
+ const failures = [];
54
+ const successes = [];
55
+ results.forEach((item, index) => {
56
+ if (!item?.id) {
57
+ failures.push({ index, reason: "No email ID returned for this item" });
58
+ } else {
59
+ successes.push({ index, id: item.id });
60
+ }
61
+ });
62
+ if (failures.length > 0) {
63
+ throw new BatchSendError(
64
+ `sendBatch: ${failures.length} of ${emails.length} emails failed`,
65
+ failures
66
+ );
67
+ }
68
+ return successes;
69
+ }
70
+ /**
71
+ * Create a ResendMailer from the `RESEND_API_KEY` environment variable.
72
+ * Recommended for server-side and CI usage.
73
+ * @throws if the environment variable is not set
74
+ */
75
+ static fromEnv() {
76
+ const key = process.env.RESEND_API_KEY;
77
+ if (!key) {
78
+ throw new Error(
79
+ 'RESEND_API_KEY environment variable is not set. Pass the key directly: new ResendMailer("re_...")'
80
+ );
81
+ }
82
+ return new _ResendMailer(key);
83
+ }
84
+ };
85
+
86
+ export { BatchSendError, ResendMailer };
87
+ //# sourceMappingURL=email.js.map
88
+ //# sourceMapp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AEA,IAAA,OAAO,SAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,OAAA,GAAwB;AAC7B,IAAA,MAAM,GAAA,GAAM,QAAQ,GAAA,CAAI,cAAA;AACxB,IAAA,IAAI,CAAC,GAAA,EAAK;AACR,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AACA,IAAA,OAAO,IAAI,cAAa,GAAG,CAAA;AAAA,EAC7B;AACF","file":"email.js","sourcesContent":["import { Resend } from 'resend';\nimport type { CreateEmailOptions } from 'resend';\n\n/**\n * Options for sending a single email or one item in a batch.\n */\nexport interface MailOptions {\n /**\n * Sender address.\n * - Custom domains (e.g. `hi@aastar.io`) must be verified in the Resend dashboard\n * (SPF/DKIM/DMARC DNS records) before use.\n * - Without domain verification, use `onboarding@resend.dev` (test only).\n */\n from: string;\n to: string | string[];\n subject: string;\n html?: string;\n text?: string;\n cc?: string | string[];\n bcc?: string | string[];\n replyTo?: string;\n attachments?: Array<{ filename: string; content: Buffer | string }>;\n headers?: Record<string, string>;\n tags?: Array<{ name: string; value: string }>;\n /**\n * ISO 8601 datetime with timezone offset for scheduled delivery.\n * Example: `\"2026-06-01T09:00:00+07:00\"` or `\"2026-06-01T02:00:00Z\"`.\n * Must be a future timestamp; Resend rejects past or timezone-ambiguous values.\n */\n scheduledAt?: string;\n /**\n * Idempotency key for agent retry scenarios.\n * Duplicate calls with the same key will not send the email again.\n * Only supported by `send()` — ignored by `sendBatch()`.\n */\n idempotencyKey?: string;\n}\n\n/** Result of a successful single send or one item in a batch result. */\nexport interface SendResult {\n id: string;\n}\n\n/** Per-item result for sendBatch — includes index for error attribution. */\nexport interface BatchSendResult {\n index: number;\n id: string;\n}\n\n/** Error thrown when one or more batch items fail. */\nexport class BatchSendError extends Error {\n constructor(\n message: string,\n public readonly failures: Array<{ index: number; reason: string }>,\n ) {\n super(message);\n this.name = 'BatchSendError';\n }\n}\n\nfunction toResendPayload(options: Omit<MailOptions, 'idempotencyKey'>): CreateEmailOptions {\n return options as unknown as CreateEmailOptions;\n}\n\n/**\n * ResendMailer — server-side email utility built on the Resend API.\n *\n * Install: `pnpm add @aastar/email`\n *\n * @example\n * ```ts\n * import { ResendMailer } from '@aastar/email';\n *\n * const mailer = ResendMailer.fromEnv(); // reads RESEND_API_KEY\n * await mailer.send({\n * from: 'hi@aastar.io',\n * to: 'user@example.com',\n * subject: 'Welcome',\n * html: '<h1>Hello!</h1>',\n * });\n * ```\n *\n * @example Agent tool with idempotency\n * ```ts\n * await mailer.send({\n * from: 'hi@aastar.io',\n * to: 'user@example.com',\n * subject: 'Your receipt',\n * html: '...',\n * idempotencyKey: `receipt-${txHash}`,\n * });\n * ```\n */\nexport class ResendMailer {\n private client: Resend;\n\n /** @param apiKey - Resend API key from https://resend.com/api-keys */\n constructor(apiKey: string) {\n if (!apiKey) {\n throw new Error('Resend API key is required. Get yours at https://resend.com/api-keys');\n }\n this.client = new Resend(apiKey);\n }\n\n /**\n * Send a single email.\n * @returns `{ id }` — Resend email ID for delivery status queries\n */\n async send(options: MailOptions): Promise<SendResult> {\n const { idempotencyKey, ...emailOptions } = options;\n const { data, error } = await this.client.emails.send(\n toResendPayload(emailOptions),\n idempotencyKey ? { idempotencyKey } : undefined,\n );\n if (error) throw new Error(`Failed to send email: ${error.message}`);\n if (!data?.id) throw new Error('Resend returned no email ID');\n return { id: data.id };\n }\n\n /**\n * Send a batch of emails (max 100 per request).\n * `idempotencyKey` is stripped per item — not supported by the batch endpoint.\n *\n * @throws {BatchSendError} if any item is missing an ID in the response\n * @returns Results in the same order as the input\n */\n async sendBatch(emails: MailOptions[]): Promise<BatchSendResult[]> {\n if (emails.length === 0) return [];\n if (emails.length > 100) {\n throw new Error('sendBatch supports at most 100 emails per request');\n }\n\n const payload = emails.map(({ idempotencyKey: _, ...rest }) => toResendPayload(rest));\n const { data, error } = await this.client.batch.send(payload);\n\n if (error) throw new Error(`Failed to send batch emails: ${error.message}`);\n\n const results = (data as unknown as Array<{ id?: string }>) ?? [];\n const failures: Array<{ index: number; reason: string }> = [];\n const successes: BatchSendResult[] = [];\n\n results.forEach((item: { id?: string }, index: number) => {\n if (!item?.id) {\n failures.push({ index, reason: 'No email ID returned for this item' });\n } else {\n successes.push({ index, id: item.id });\n }\n });\n\n if (failures.length > 0) {\n throw new BatchSendError(\n `sendBatch: ${failures.length} of ${emails.length} emails failed`,\n failures,\n );\n }\n\n return successes;\n }\n\n /**\n * Create a ResendMailer from the `RESEND_API_KEY` environment variable.\n * Recommended for server-side and CI usage.\n * @throws if the environment variable is not set\n */\n static fromEnv(): ResendMailer {\n const key = process.env.RESEND_API_KEY;\n if (!key) {\n throw new Error(\n 'RESEND_API_KEY environment variable is not set. Pass the key directly: new ResendMailer(\"re_...\")',\n );\n }\n return new ResendMailer(key);\n }\n}\n"]}
package/dist/enduser.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkBOVDJSMK_cjs = require('./chunk-BOVDJSMK.cjs');
4
- var chunk5PH5CSM7_cjs = require('./chunk-5PH5CSM7.cjs');
5
- require('./chunk-MOJJ7QF6.cjs');
3
+ var chunk3FRNYRWI_cjs = require('./chunk-3FRNYRWI.cjs');
4
+ var chunkTGEVD7OR_cjs = require('./chunk-TGEVD7OR.cjs');
5
+ require('./chunk-IB3KOSHW.cjs');
6
6
  require('./chunk-MXJEULSE.cjs');
7
7
  require('./chunk-Q7SFCCGT.cjs');
8
8
 
@@ -10,15 +10,15 @@ require('./chunk-Q7SFCCGT.cjs');
10
10
 
11
11
  Object.defineProperty(exports, "CommunityClient", {
12
12
  enumerable: true,
13
- get: function () { return chunkBOVDJSMK_cjs.CommunityClient; }
13
+ get: function () { return chunk3FRNYRWI_cjs.CommunityClient; }
14
14
  });
15
15
  Object.defineProperty(exports, "UserLifecycle", {
16
16
  enumerable: true,
17
- get: function () { return chunkBOVDJSMK_cjs.UserLifecycle; }
17
+ get: function () { return chunk3FRNYRWI_cjs.UserLifecycle; }
18
18
  });
19
19
  Object.defineProperty(exports, "UserClient", {
20
20
  enumerable: true,
21
- get: function () { return chunk5PH5CSM7_cjs.UserClient; }
21
+ get: function () { return chunkTGEVD7OR_cjs.UserClient; }
22
22
  });
23
23
  //# sourceMappingURL=enduser.cjs.map
24
24
  //# sourceMappingURL=enduser.cjs.map
package/dist/enduser.js CHANGED
@@ -1,6 +1,6 @@
1
- export { CommunityClient, UserLifecycle } from './chunk-JMW5AHLC.js';
2
- export { UserClient } from './chunk-PXQDAFXD.js';
3
- import './chunk-BYVG7MO7.js';
1
+ export { CommunityClient, UserLifecycle } from './chunk-SX5GUCTF.js';
2
+ export { UserClient } from './chunk-W73Y6JWZ.js';
3
+ import './chunk-EEWLL7GE.js';
4
4
  import './chunk-UCLK6LTB.js';
5
5
  import './chunk-PZ5AY32C.js';
6
6
  //# sourceMappingURL=enduser.js.map
package/dist/identity.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk72JZKARR_cjs = require('./chunk-72JZKARR.cjs');
4
- require('./chunk-MOJJ7QF6.cjs');
3
+ var chunkS7IUUQ5E_cjs = require('./chunk-S7IUUQ5E.cjs');
4
+ require('./chunk-IB3KOSHW.cjs');
5
5
  require('./chunk-MXJEULSE.cjs');
6
6
  require('./chunk-Q7SFCCGT.cjs');
7
7
 
@@ -9,15 +9,15 @@ require('./chunk-Q7SFCCGT.cjs');
9
9
 
10
10
  Object.defineProperty(exports, "ReputationClient", {
11
11
  enumerable: true,
12
- get: function () { return chunk72JZKARR_cjs.ReputationClient; }
12
+ get: function () { return chunkS7IUUQ5E_cjs.ReputationClient; }
13
13
  });
14
14
  Object.defineProperty(exports, "checkMySBT", {
15
15
  enumerable: true,
16
- get: function () { return chunk72JZKARR_cjs.checkMySBT; }
16
+ get: function () { return chunkS7IUUQ5E_cjs.checkMySBT; }
17
17
  });
18
18
  Object.defineProperty(exports, "getMySBTId", {
19
19
  enumerable: true,
20
- get: function () { return chunk72JZKARR_cjs.getMySBTId; }
20
+ get: function () { return chunkS7IUUQ5E_cjs.getMySBTId; }
21
21
  });
22
22
  //# sourceMappingURL=identity.cjs.map
23
23
  //# sourceMappingURL=identity.cjs.map
package/dist/identity.js CHANGED
@@ -1,5 +1,5 @@
1
- export { ReputationClient, checkMySBT, getMySBTId } from './chunk-RZ2M2RVP.js';
2
- import './chunk-BYVG7MO7.js';
1
+ export { ReputationClient, checkMySBT, getMySBTId } from './chunk-PUE5GEKK.js';
2
+ import './chunk-EEWLL7GE.js';
3
3
  import './chunk-UCLK6LTB.js';
4
4
  import './chunk-PZ5AY32C.js';
5
5
  //# sourceMappingURL=identity.js.map