@sudobility/types 1.8.21
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/CLAUDE.md +285 -0
- package/README.md +310 -0
- package/dist/index.cjs +62 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/types/blockchain/common.cjs +102 -0
- package/dist/types/blockchain/common.d.ts +262 -0
- package/dist/types/blockchain/common.d.ts.map +1 -0
- package/dist/types/blockchain/common.js +102 -0
- package/dist/types/blockchain/common.js.map +1 -0
- package/dist/types/blockchain/index.cjs +18 -0
- package/dist/types/blockchain/index.d.ts +4 -0
- package/dist/types/blockchain/index.d.ts.map +1 -0
- package/dist/types/blockchain/index.js +18 -0
- package/dist/types/blockchain/index.js.map +1 -0
- package/dist/types/blockchain/validation.cjs +88 -0
- package/dist/types/blockchain/validation.d.ts +9 -0
- package/dist/types/blockchain/validation.d.ts.map +1 -0
- package/dist/types/blockchain/validation.js +88 -0
- package/dist/types/blockchain/validation.js.map +1 -0
- package/dist/types/business/enums.cjs +314 -0
- package/dist/types/business/enums.d.ts +227 -0
- package/dist/types/business/enums.d.ts.map +1 -0
- package/dist/types/business/enums.js +314 -0
- package/dist/types/business/enums.js.map +1 -0
- package/dist/types/business/index.cjs +33 -0
- package/dist/types/business/index.d.ts +5 -0
- package/dist/types/business/index.d.ts.map +1 -0
- package/dist/types/business/index.js +33 -0
- package/dist/types/business/index.js.map +1 -0
- package/dist/types/business/wallet-status.cjs +38 -0
- package/dist/types/business/wallet-status.d.ts +32 -0
- package/dist/types/business/wallet-status.d.ts.map +1 -0
- package/dist/types/business/wallet-status.js +38 -0
- package/dist/types/business/wallet-status.js.map +1 -0
- package/dist/types/common.cjs +6 -0
- package/dist/types/common.d.ts +142 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +6 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/config/app-config.cjs +6 -0
- package/dist/types/config/app-config.d.ts +67 -0
- package/dist/types/config/app-config.d.ts.map +1 -0
- package/dist/types/config/app-config.js +6 -0
- package/dist/types/config/app-config.js.map +1 -0
- package/dist/types/config/environment.cjs +24 -0
- package/dist/types/config/environment.d.ts +68 -0
- package/dist/types/config/environment.d.ts.map +1 -0
- package/dist/types/config/environment.js +24 -0
- package/dist/types/config/environment.js.map +1 -0
- package/dist/types/config/index.cjs +6 -0
- package/dist/types/config/index.d.ts +4 -0
- package/dist/types/config/index.d.ts.map +1 -0
- package/dist/types/config/index.js +6 -0
- package/dist/types/config/index.js.map +1 -0
- package/dist/types/index.cjs +35 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +35 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/indexer/index.cjs +19 -0
- package/dist/types/indexer/index.d.ts +3 -0
- package/dist/types/indexer/index.d.ts.map +1 -0
- package/dist/types/indexer/index.js +19 -0
- package/dist/types/indexer/index.js.map +1 -0
- package/dist/types/indexer/indexer-guards.cjs +145 -0
- package/dist/types/indexer/indexer-guards.d.ts +26 -0
- package/dist/types/indexer/indexer-guards.d.ts.map +1 -0
- package/dist/types/indexer/indexer-guards.js +145 -0
- package/dist/types/indexer/indexer-guards.js.map +1 -0
- package/dist/types/indexer/indexer-responses.cjs +8 -0
- package/dist/types/indexer/indexer-responses.d.ts +136 -0
- package/dist/types/indexer/indexer-responses.d.ts.map +1 -0
- package/dist/types/indexer/indexer-responses.js +8 -0
- package/dist/types/indexer/indexer-responses.js.map +1 -0
- package/dist/types/infrastructure/analytics.cjs +212 -0
- package/dist/types/infrastructure/analytics.d.ts +449 -0
- package/dist/types/infrastructure/analytics.d.ts.map +1 -0
- package/dist/types/infrastructure/analytics.js +212 -0
- package/dist/types/infrastructure/analytics.js.map +1 -0
- package/dist/types/infrastructure/api.cjs +17 -0
- package/dist/types/infrastructure/api.d.ts +152 -0
- package/dist/types/infrastructure/api.d.ts.map +1 -0
- package/dist/types/infrastructure/api.js +17 -0
- package/dist/types/infrastructure/api.js.map +1 -0
- package/dist/types/infrastructure/index.cjs +14 -0
- package/dist/types/infrastructure/index.d.ts +9 -0
- package/dist/types/infrastructure/index.d.ts.map +1 -0
- package/dist/types/infrastructure/index.js +14 -0
- package/dist/types/infrastructure/index.js.map +1 -0
- package/dist/types/infrastructure/navigation.cjs +3 -0
- package/dist/types/infrastructure/navigation.d.ts +56 -0
- package/dist/types/infrastructure/navigation.d.ts.map +1 -0
- package/dist/types/infrastructure/navigation.js +3 -0
- package/dist/types/infrastructure/navigation.js.map +1 -0
- package/dist/types/infrastructure/network.cjs +18 -0
- package/dist/types/infrastructure/network.d.ts +48 -0
- package/dist/types/infrastructure/network.d.ts.map +1 -0
- package/dist/types/infrastructure/network.js +18 -0
- package/dist/types/infrastructure/network.js.map +1 -0
- package/dist/types/infrastructure/wallet.cjs +37 -0
- package/dist/types/infrastructure/wallet.d.ts +33 -0
- package/dist/types/infrastructure/wallet.d.ts.map +1 -0
- package/dist/types/infrastructure/wallet.js +37 -0
- package/dist/types/infrastructure/wallet.js.map +1 -0
- package/dist/types/kyc/index.cjs +19 -0
- package/dist/types/kyc/index.d.ts +2 -0
- package/dist/types/kyc/index.d.ts.map +1 -0
- package/dist/types/kyc/index.js +19 -0
- package/dist/types/kyc/index.js.map +1 -0
- package/dist/types/kyc/kyc-types.cjs +12 -0
- package/dist/types/kyc/kyc-types.d.ts +260 -0
- package/dist/types/kyc/kyc-types.d.ts.map +1 -0
- package/dist/types/kyc/kyc-types.js +12 -0
- package/dist/types/kyc/kyc-types.js.map +1 -0
- package/dist/types/mailer/index.cjs +19 -0
- package/dist/types/mailer/index.d.ts +2 -0
- package/dist/types/mailer/index.d.ts.map +1 -0
- package/dist/types/mailer/index.js +19 -0
- package/dist/types/mailer/index.js.map +1 -0
- package/dist/types/mailer/mail-types.cjs +38 -0
- package/dist/types/mailer/mail-types.d.ts +296 -0
- package/dist/types/mailer/mail-types.d.ts.map +1 -0
- package/dist/types/mailer/mail-types.js +38 -0
- package/dist/types/mailer/mail-types.js.map +1 -0
- package/dist/types/wildduck/index.cjs +19 -0
- package/dist/types/wildduck/index.d.ts +2 -0
- package/dist/types/wildduck/index.d.ts.map +1 -0
- package/dist/types/wildduck/index.js +19 -0
- package/dist/types/wildduck/index.js.map +1 -0
- package/dist/types/wildduck/wildduck-types.cjs +48 -0
- package/dist/types/wildduck/wildduck-types.d.ts +1239 -0
- package/dist/types/wildduck/wildduck-types.d.ts.map +1 -0
- package/dist/types/wildduck/wildduck-types.js +48 -0
- package/dist/types/wildduck/wildduck-types.js.map +1 -0
- package/dist/utils/async-helpers.cjs +130 -0
- package/dist/utils/async-helpers.d.ts +35 -0
- package/dist/utils/async-helpers.d.ts.map +1 -0
- package/dist/utils/async-helpers.js +130 -0
- package/dist/utils/async-helpers.js.map +1 -0
- package/dist/utils/auth/auth.cjs +96 -0
- package/dist/utils/auth/auth.d.ts +40 -0
- package/dist/utils/auth/auth.d.ts.map +1 -0
- package/dist/utils/auth/auth.js +96 -0
- package/dist/utils/auth/auth.js.map +1 -0
- package/dist/utils/auth/index.cjs +14 -0
- package/dist/utils/auth/index.d.ts +2 -0
- package/dist/utils/auth/index.d.ts.map +1 -0
- package/dist/utils/auth/index.js +14 -0
- package/dist/utils/auth/index.js.map +1 -0
- package/dist/utils/blockchain/address.cjs +231 -0
- package/dist/utils/blockchain/address.d.ts +65 -0
- package/dist/utils/blockchain/address.d.ts.map +1 -0
- package/dist/utils/blockchain/address.js +231 -0
- package/dist/utils/blockchain/address.js.map +1 -0
- package/dist/utils/blockchain/event-helpers.cjs +143 -0
- package/dist/utils/blockchain/event-helpers.d.ts +87 -0
- package/dist/utils/blockchain/event-helpers.d.ts.map +1 -0
- package/dist/utils/blockchain/event-helpers.js +143 -0
- package/dist/utils/blockchain/event-helpers.js.map +1 -0
- package/dist/utils/blockchain/index.cjs +30 -0
- package/dist/utils/blockchain/index.d.ts +8 -0
- package/dist/utils/blockchain/index.d.ts.map +1 -0
- package/dist/utils/blockchain/index.js +30 -0
- package/dist/utils/blockchain/index.js.map +1 -0
- package/dist/utils/blockchain/rpc-helpers.cjs +865 -0
- package/dist/utils/blockchain/rpc-helpers.d.ts +251 -0
- package/dist/utils/blockchain/rpc-helpers.d.ts.map +1 -0
- package/dist/utils/blockchain/rpc-helpers.js +865 -0
- package/dist/utils/blockchain/rpc-helpers.js.map +1 -0
- package/dist/utils/constants/application.cjs +158 -0
- package/dist/utils/constants/application.d.ts +119 -0
- package/dist/utils/constants/application.d.ts.map +1 -0
- package/dist/utils/constants/application.js +158 -0
- package/dist/utils/constants/application.js.map +1 -0
- package/dist/utils/constants/index.cjs +30 -0
- package/dist/utils/constants/index.d.ts +7 -0
- package/dist/utils/constants/index.d.ts.map +1 -0
- package/dist/utils/constants/index.js +30 -0
- package/dist/utils/constants/index.js.map +1 -0
- package/dist/utils/constants/status-values.cjs +14 -0
- package/dist/utils/constants/status-values.d.ts +12 -0
- package/dist/utils/constants/status-values.d.ts.map +1 -0
- package/dist/utils/constants/status-values.js +14 -0
- package/dist/utils/constants/status-values.js.map +1 -0
- package/dist/utils/formatting/currency.cjs +36 -0
- package/dist/utils/formatting/currency.d.ts +26 -0
- package/dist/utils/formatting/currency.d.ts.map +1 -0
- package/dist/utils/formatting/currency.js +36 -0
- package/dist/utils/formatting/currency.js.map +1 -0
- package/dist/utils/formatting/date.cjs +138 -0
- package/dist/utils/formatting/date.d.ts +33 -0
- package/dist/utils/formatting/date.d.ts.map +1 -0
- package/dist/utils/formatting/date.js +138 -0
- package/dist/utils/formatting/date.js.map +1 -0
- package/dist/utils/formatting/index.cjs +37 -0
- package/dist/utils/formatting/index.d.ts +4 -0
- package/dist/utils/formatting/index.d.ts.map +1 -0
- package/dist/utils/formatting/index.js +37 -0
- package/dist/utils/formatting/index.js.map +1 -0
- package/dist/utils/formatting/string.cjs +193 -0
- package/dist/utils/formatting/string.d.ts +69 -0
- package/dist/utils/formatting/string.d.ts.map +1 -0
- package/dist/utils/formatting/string.js +193 -0
- package/dist/utils/formatting/string.js.map +1 -0
- package/dist/utils/index.cjs +28 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +28 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logging/index.cjs +16 -0
- package/dist/utils/logging/index.d.ts +5 -0
- package/dist/utils/logging/index.d.ts.map +1 -0
- package/dist/utils/logging/index.js +16 -0
- package/dist/utils/logging/index.js.map +1 -0
- package/dist/utils/logging/logger.cjs +92 -0
- package/dist/utils/logging/logger.d.ts +70 -0
- package/dist/utils/logging/logger.d.ts.map +1 -0
- package/dist/utils/logging/logger.js +92 -0
- package/dist/utils/logging/logger.js.map +1 -0
- package/dist/utils/url/index.cjs +13 -0
- package/dist/utils/url/index.d.ts +5 -0
- package/dist/utils/url/index.d.ts.map +1 -0
- package/dist/utils/url/index.js +13 -0
- package/dist/utils/url/index.js.map +1 -0
- package/dist/utils/url/url-params.cjs +128 -0
- package/dist/utils/url/url-params.d.ts +36 -0
- package/dist/utils/url/url-params.d.ts.map +1 -0
- package/dist/utils/url/url-params.js +128 -0
- package/dist/utils/url/url-params.js.map +1 -0
- package/dist/utils/validation/index.cjs +25 -0
- package/dist/utils/validation/index.d.ts +5 -0
- package/dist/utils/validation/index.d.ts.map +1 -0
- package/dist/utils/validation/index.js +25 -0
- package/dist/utils/validation/index.js.map +1 -0
- package/dist/utils/validation/type-validation.cjs +167 -0
- package/dist/utils/validation/type-validation.d.ts +68 -0
- package/dist/utils/validation/type-validation.d.ts.map +1 -0
- package/dist/utils/validation/type-validation.js +167 -0
- package/dist/utils/validation/type-validation.js.map +1 -0
- package/dist/utils/validation/web3-username-validator.cjs +132 -0
- package/dist/utils/validation/web3-username-validator.d.ts +43 -0
- package/dist/utils/validation/web3-username-validator.d.ts.map +1 -0
- package/dist/utils/validation/web3-username-validator.js +132 -0
- package/dist/utils/validation/web3-username-validator.js.map +1 -0
- package/package.json +80 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @johnqh/types - Common TypeScript types for 0xmail.box projects
|
|
4
|
+
*
|
|
5
|
+
* This package contains all shared TypeScript definitions used across
|
|
6
|
+
* the 0xmail.box ecosystem including business logic types, blockchain
|
|
7
|
+
* types, configuration interfaces, infrastructure types, and utility functions.
|
|
8
|
+
*
|
|
9
|
+
* @version 1.0.0
|
|
10
|
+
* @license MIT
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
24
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.StorageType = exports.WalletType = exports.ChainType = exports.AnalyticsEvent = exports.TransactionStatus = exports.MessageType = exports.NotificationType = exports.RequestStatus = exports.MobileView = exports.EmailComposeType = exports.FontSize = exports.Theme = exports.Chain = exports.AuthStatus = exports.debounceAsync = exports.clearExpiredCache = exports.withCache = exports.withTimeout = exports.safeParallel = exports.withLoadingState = exports.safeAsync = exports.RpcHelpers = void 0;
|
|
28
|
+
// Re-export all types from the types module
|
|
29
|
+
__exportStar(require("./types"), exports);
|
|
30
|
+
// Re-export all utilities
|
|
31
|
+
__exportStar(require("./utils"), exports);
|
|
32
|
+
var utils_1 = require("./utils");
|
|
33
|
+
Object.defineProperty(exports, "RpcHelpers", { enumerable: true, get: function () { return utils_1.RpcHelpers; } });
|
|
34
|
+
// Export async utilities
|
|
35
|
+
var utils_2 = require("./utils");
|
|
36
|
+
Object.defineProperty(exports, "safeAsync", { enumerable: true, get: function () { return utils_2.safeAsync; } });
|
|
37
|
+
Object.defineProperty(exports, "withLoadingState", { enumerable: true, get: function () { return utils_2.withLoadingState; } });
|
|
38
|
+
Object.defineProperty(exports, "safeParallel", { enumerable: true, get: function () { return utils_2.safeParallel; } });
|
|
39
|
+
Object.defineProperty(exports, "withTimeout", { enumerable: true, get: function () { return utils_2.withTimeout; } });
|
|
40
|
+
Object.defineProperty(exports, "withCache", { enumerable: true, get: function () { return utils_2.withCache; } });
|
|
41
|
+
Object.defineProperty(exports, "clearExpiredCache", { enumerable: true, get: function () { return utils_2.clearExpiredCache; } });
|
|
42
|
+
Object.defineProperty(exports, "debounceAsync", { enumerable: true, get: function () { return utils_2.debounceAsync; } });
|
|
43
|
+
// Export the most commonly used enums
|
|
44
|
+
var types_1 = require("./types");
|
|
45
|
+
// Business enums
|
|
46
|
+
Object.defineProperty(exports, "AuthStatus", { enumerable: true, get: function () { return types_1.AuthStatus; } });
|
|
47
|
+
Object.defineProperty(exports, "Chain", { enumerable: true, get: function () { return types_1.Chain; } });
|
|
48
|
+
Object.defineProperty(exports, "Theme", { enumerable: true, get: function () { return types_1.Theme; } });
|
|
49
|
+
Object.defineProperty(exports, "FontSize", { enumerable: true, get: function () { return types_1.FontSize; } });
|
|
50
|
+
Object.defineProperty(exports, "EmailComposeType", { enumerable: true, get: function () { return types_1.EmailComposeType; } });
|
|
51
|
+
Object.defineProperty(exports, "MobileView", { enumerable: true, get: function () { return types_1.MobileView; } });
|
|
52
|
+
Object.defineProperty(exports, "RequestStatus", { enumerable: true, get: function () { return types_1.RequestStatus; } });
|
|
53
|
+
Object.defineProperty(exports, "NotificationType", { enumerable: true, get: function () { return types_1.NotificationType; } });
|
|
54
|
+
// Blockchain enums
|
|
55
|
+
Object.defineProperty(exports, "MessageType", { enumerable: true, get: function () { return types_1.MessageType; } });
|
|
56
|
+
Object.defineProperty(exports, "TransactionStatus", { enumerable: true, get: function () { return types_1.TransactionStatus; } });
|
|
57
|
+
// Infrastructure enums
|
|
58
|
+
Object.defineProperty(exports, "AnalyticsEvent", { enumerable: true, get: function () { return types_1.AnalyticsEvent; } });
|
|
59
|
+
Object.defineProperty(exports, "ChainType", { enumerable: true, get: function () { return types_1.ChainType; } });
|
|
60
|
+
Object.defineProperty(exports, "WalletType", { enumerable: true, get: function () { return types_1.WalletType; } });
|
|
61
|
+
Object.defineProperty(exports, "StorageType", { enumerable: true, get: function () { return types_1.StorageType; } });
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;AAEH,4CAA4C;AAC5C,0CAAwB;AAExB,0BAA0B;AAC1B,0CAAwB;AA0GxB,iCAAqC;AAA5B,mGAAA,UAAU,OAAA;AAEnB,yBAAyB;AACzB,iCASiB;AARf,kGAAA,SAAS,OAAA;AACT,yGAAA,gBAAgB,OAAA;AAChB,qGAAA,YAAY,OAAA;AACZ,oGAAA,WAAW,OAAA;AACX,kGAAA,SAAS,OAAA;AACT,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AAIf,sCAAsC;AACtC,iCAoBiB;AAnBf,iBAAiB;AACjB,mGAAA,UAAU,OAAA;AACV,8FAAA,KAAK,OAAA;AACL,8FAAA,KAAK,OAAA;AACL,iGAAA,QAAQ,OAAA;AACR,yGAAA,gBAAgB,OAAA;AAChB,mGAAA,UAAU,OAAA;AACV,sGAAA,aAAa,OAAA;AACb,yGAAA,gBAAgB,OAAA;AAEhB,mBAAmB;AACnB,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AAEjB,uBAAuB;AACvB,uGAAA,cAAc,OAAA;AACd,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,oGAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Common type definitions for multi-chain MailBox system
|
|
4
|
+
* @description Shared types and interfaces for EVM and Solana implementations
|
|
5
|
+
* @author MailBox Team
|
|
6
|
+
* @version 1.4.2
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PROTOCOL_CONSTANTS = exports.TransactionStatus = exports.MessageType = void 0;
|
|
10
|
+
exports.isSolanaAddress = isSolanaAddress;
|
|
11
|
+
exports.isEvmAddress = isEvmAddress;
|
|
12
|
+
exports.isSolanaRecipient = isSolanaRecipient;
|
|
13
|
+
exports.isEvmRecipient = isEvmRecipient;
|
|
14
|
+
/**
|
|
15
|
+
* Message type enumeration
|
|
16
|
+
* @enum MessageType
|
|
17
|
+
*/
|
|
18
|
+
var MessageType;
|
|
19
|
+
(function (MessageType) {
|
|
20
|
+
/** Standard message with 10% fee */
|
|
21
|
+
MessageType["STANDARD"] = "standard";
|
|
22
|
+
/** Priority message with full fee and 90% revenue share */
|
|
23
|
+
MessageType["PRIORITY"] = "priority";
|
|
24
|
+
/** Pre-prepared standard message */
|
|
25
|
+
MessageType["PREPARED_STANDARD"] = "prepared_standard";
|
|
26
|
+
/** Pre-prepared priority message */
|
|
27
|
+
MessageType["PREPARED_PRIORITY"] = "prepared_priority";
|
|
28
|
+
})(MessageType || (exports.MessageType = MessageType = {}));
|
|
29
|
+
/**
|
|
30
|
+
* Transaction status enumeration
|
|
31
|
+
* @enum TransactionStatus
|
|
32
|
+
*/
|
|
33
|
+
var TransactionStatus;
|
|
34
|
+
(function (TransactionStatus) {
|
|
35
|
+
/** Transaction successful */
|
|
36
|
+
TransactionStatus["SUCCESS"] = "success";
|
|
37
|
+
/** Transaction failed */
|
|
38
|
+
TransactionStatus["FAILED"] = "failed";
|
|
39
|
+
/** Transaction pending confirmation */
|
|
40
|
+
TransactionStatus["PENDING"] = "pending";
|
|
41
|
+
})(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// TYPE GUARDS
|
|
44
|
+
// ============================================================================
|
|
45
|
+
/**
|
|
46
|
+
* Type guard to check if a value is a Solana PublicKey string
|
|
47
|
+
* @param value - Value to check
|
|
48
|
+
* @returns True if value is a valid Solana address
|
|
49
|
+
*/
|
|
50
|
+
function isSolanaAddress(value) {
|
|
51
|
+
return (typeof value === 'string' && /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(value));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Type guard to check if a value is an EVM address
|
|
55
|
+
* @param value - Value to check
|
|
56
|
+
* @returns True if value is EVM address string
|
|
57
|
+
*/
|
|
58
|
+
function isEvmAddress(value) {
|
|
59
|
+
return typeof value === 'string' && /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Type guard to check if recipient is for Solana
|
|
63
|
+
* @param recipient - Message recipient
|
|
64
|
+
* @returns True if recipient is Solana address
|
|
65
|
+
*/
|
|
66
|
+
function isSolanaRecipient(recipient) {
|
|
67
|
+
return isSolanaAddress(recipient);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Type guard to check if recipient is for EVM
|
|
71
|
+
* @param recipient - Message recipient
|
|
72
|
+
* @returns True if recipient is EVM address
|
|
73
|
+
*/
|
|
74
|
+
function isEvmRecipient(recipient) {
|
|
75
|
+
return isEvmAddress(recipient);
|
|
76
|
+
}
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// CONSTANTS
|
|
79
|
+
// ============================================================================
|
|
80
|
+
/**
|
|
81
|
+
* Protocol constants used across implementations
|
|
82
|
+
*/
|
|
83
|
+
exports.PROTOCOL_CONSTANTS = {
|
|
84
|
+
/** Base send fee: 0.1 USDC (100,000 with 6 decimals) */
|
|
85
|
+
SEND_FEE: 100000n,
|
|
86
|
+
/** Claim period: 60 days in seconds */
|
|
87
|
+
CLAIM_PERIOD: 60 * 24 * 60 * 60,
|
|
88
|
+
/** Revenue share percentages */
|
|
89
|
+
REVENUE_SHARES: {
|
|
90
|
+
SENDER: 90,
|
|
91
|
+
OWNER: 10,
|
|
92
|
+
},
|
|
93
|
+
/** USDC token decimals */
|
|
94
|
+
USDC_DECIMALS: 6,
|
|
95
|
+
/** Maximum message lengths */
|
|
96
|
+
MAX_LENGTHS: {
|
|
97
|
+
SUBJECT: 200,
|
|
98
|
+
BODY: 2000,
|
|
99
|
+
MAIL_ID: 100,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Common type definitions for multi-chain MailBox system
|
|
3
|
+
* @description Shared types and interfaces for EVM and Solana implementations
|
|
4
|
+
* @author MailBox Team
|
|
5
|
+
* @version 1.4.2
|
|
6
|
+
*/
|
|
7
|
+
import { MessageBase, UnifiedError, Result, Optional } from '../common';
|
|
8
|
+
import { Chain } from '../business/enums';
|
|
9
|
+
/**
|
|
10
|
+
* Chain configuration with API keys
|
|
11
|
+
* All other chain information (RPC URLs, chain ID, USDC addresses, etc.)
|
|
12
|
+
* can be derived using RpcHelpers
|
|
13
|
+
*/
|
|
14
|
+
export interface ChainConfig {
|
|
15
|
+
/** Chain identifier */
|
|
16
|
+
chain: Chain;
|
|
17
|
+
/** Alchemy API key for RPC access */
|
|
18
|
+
alchemyApiKey: string;
|
|
19
|
+
/** Etherscan Multichain API key for block explorer access */
|
|
20
|
+
etherscanApiKey: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Represents a message recipient - can be EVM address or Solana PublicKey string
|
|
24
|
+
* @example
|
|
25
|
+
* // EVM
|
|
26
|
+
* const evmRecipient: MessageRecipient = "0x742d35Cc6634C0532925a3b8D2C36B7f1234567";
|
|
27
|
+
*
|
|
28
|
+
* // Solana
|
|
29
|
+
* const solanaRecipient: MessageRecipient = "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM";
|
|
30
|
+
*/
|
|
31
|
+
export type MessageRecipient = string;
|
|
32
|
+
/**
|
|
33
|
+
* Core message structure used across all chains
|
|
34
|
+
* @interface Message
|
|
35
|
+
*/
|
|
36
|
+
export interface Message extends Omit<MessageBase, 'from' | 'to'> {
|
|
37
|
+
/** Message sender address/pubkey */
|
|
38
|
+
from: MessageRecipient;
|
|
39
|
+
/** Message recipient address/pubkey */
|
|
40
|
+
to: MessageRecipient;
|
|
41
|
+
/** Block timestamp when sent */
|
|
42
|
+
timestamp: number;
|
|
43
|
+
/** Transaction hash/signature */
|
|
44
|
+
txHash: string;
|
|
45
|
+
/** Message type classification */
|
|
46
|
+
messageType: MessageType;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Pre-prepared message using external storage
|
|
50
|
+
* @interface PreparedMessage
|
|
51
|
+
*/
|
|
52
|
+
export interface PreparedMessage {
|
|
53
|
+
/** Message sender address/pubkey */
|
|
54
|
+
from: MessageRecipient;
|
|
55
|
+
/** Message recipient address/pubkey */
|
|
56
|
+
to: MessageRecipient;
|
|
57
|
+
/** External message identifier (IPFS hash, UUID, etc.) */
|
|
58
|
+
mailId: string;
|
|
59
|
+
/** Block timestamp when sent */
|
|
60
|
+
timestamp: number;
|
|
61
|
+
/** Transaction hash/signature */
|
|
62
|
+
txHash: string;
|
|
63
|
+
/** Message type classification */
|
|
64
|
+
messageType: MessageType;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Message type enumeration
|
|
68
|
+
* @enum MessageType
|
|
69
|
+
*/
|
|
70
|
+
export declare enum MessageType {
|
|
71
|
+
/** Standard message with 10% fee */
|
|
72
|
+
STANDARD = "standard",
|
|
73
|
+
/** Priority message with full fee and 90% revenue share */
|
|
74
|
+
PRIORITY = "priority",
|
|
75
|
+
/** Pre-prepared standard message */
|
|
76
|
+
PREPARED_STANDARD = "prepared_standard",
|
|
77
|
+
/** Pre-prepared priority message */
|
|
78
|
+
PREPARED_PRIORITY = "prepared_priority"
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Fee structure for messages
|
|
82
|
+
* @interface FeeStructure
|
|
83
|
+
*/
|
|
84
|
+
export interface FeeStructure {
|
|
85
|
+
/** Base send fee (0.1 USDC with 6 decimals) */
|
|
86
|
+
sendFee: bigint;
|
|
87
|
+
/** Fee for standard messages (10% of sendFee) */
|
|
88
|
+
standardFee: bigint;
|
|
89
|
+
/** Fee for priority messages (100% of sendFee) */
|
|
90
|
+
priorityFee: bigint;
|
|
91
|
+
/** Owner share percentage (10%) */
|
|
92
|
+
ownerShare: number;
|
|
93
|
+
/** Sender revenue share percentage (90%) */
|
|
94
|
+
senderShare: number;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Claimable revenue information
|
|
98
|
+
* @interface ClaimableRevenue
|
|
99
|
+
*/
|
|
100
|
+
export interface ClaimableRevenue {
|
|
101
|
+
/** Amount claimable in USDC */
|
|
102
|
+
amount: bigint;
|
|
103
|
+
/** Timestamp when claim was created */
|
|
104
|
+
timestamp: number;
|
|
105
|
+
/** Expiration timestamp (60 days from creation) */
|
|
106
|
+
expiresAt: number;
|
|
107
|
+
/** Whether the claim has expired */
|
|
108
|
+
isExpired: boolean;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Contract/Program addresses for deployment
|
|
112
|
+
* @interface DeploymentAddresses
|
|
113
|
+
*/
|
|
114
|
+
export interface DeploymentAddresses {
|
|
115
|
+
/** Mailer contract/program address */
|
|
116
|
+
mailer: string;
|
|
117
|
+
/** MailService contract/program address (if applicable) */
|
|
118
|
+
mailService?: Optional<string>;
|
|
119
|
+
/** USDC token mint/contract address */
|
|
120
|
+
usdcToken: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Configuration for unified client
|
|
124
|
+
* @interface ClientConfig
|
|
125
|
+
*/
|
|
126
|
+
export interface ClientConfig {
|
|
127
|
+
/** RPC endpoint URL */
|
|
128
|
+
rpcUrl: string;
|
|
129
|
+
/** Chain ID */
|
|
130
|
+
chainId: number;
|
|
131
|
+
/** Contract/program addresses */
|
|
132
|
+
addresses: DeploymentAddresses;
|
|
133
|
+
/** Optional wallet private key for signing */
|
|
134
|
+
privateKey?: Optional<string>;
|
|
135
|
+
/** Optional custom RPC configuration */
|
|
136
|
+
rpcConfig?: Optional<RpcConfig>;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* RPC configuration options
|
|
140
|
+
* @interface RpcConfig
|
|
141
|
+
*/
|
|
142
|
+
export interface RpcConfig {
|
|
143
|
+
/** Request timeout in milliseconds */
|
|
144
|
+
timeout?: Optional<number>;
|
|
145
|
+
/** Maximum retry attempts */
|
|
146
|
+
maxRetries?: Optional<number>;
|
|
147
|
+
/** Rate limiting options */
|
|
148
|
+
rateLimit?: Optional<{
|
|
149
|
+
requestsPerSecond: number;
|
|
150
|
+
maxConcurrent: number;
|
|
151
|
+
}>;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Transaction result for successful operations
|
|
155
|
+
* @interface TransactionResult
|
|
156
|
+
*/
|
|
157
|
+
export interface TransactionResult {
|
|
158
|
+
/** Transaction hash/signature */
|
|
159
|
+
txHash: string;
|
|
160
|
+
/** Block number/slot */
|
|
161
|
+
block: number;
|
|
162
|
+
/** Gas/compute units used */
|
|
163
|
+
gasUsed?: Optional<bigint>;
|
|
164
|
+
/** Transaction status */
|
|
165
|
+
status: TransactionStatus;
|
|
166
|
+
/** Optional logs/events emitted */
|
|
167
|
+
logs?: Optional<string[]>;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Transaction status enumeration
|
|
171
|
+
* @enum TransactionStatus
|
|
172
|
+
*/
|
|
173
|
+
export declare enum TransactionStatus {
|
|
174
|
+
/** Transaction successful */
|
|
175
|
+
SUCCESS = "success",// STATUS_VALUES.SUCCESS
|
|
176
|
+
/** Transaction failed */
|
|
177
|
+
FAILED = "failed",// STATUS_VALUES.FAILED
|
|
178
|
+
/** Transaction pending confirmation */
|
|
179
|
+
PENDING = "pending"
|
|
180
|
+
}
|
|
181
|
+
export type { UnifiedError, Result };
|
|
182
|
+
export type OperationError = UnifiedError;
|
|
183
|
+
/**
|
|
184
|
+
* Options for sending messages
|
|
185
|
+
* @interface SendMessageOptions
|
|
186
|
+
*/
|
|
187
|
+
export interface SendMessageOptions {
|
|
188
|
+
/** Message priority level */
|
|
189
|
+
priority?: Optional<'standard' | 'priority'>;
|
|
190
|
+
/** Optional gas price/compute budget override */
|
|
191
|
+
gasConfig?: Optional<{
|
|
192
|
+
gasPrice?: Optional<bigint>;
|
|
193
|
+
gasLimit?: Optional<bigint>;
|
|
194
|
+
}>;
|
|
195
|
+
/** Optional confirmation requirements */
|
|
196
|
+
confirmations?: Optional<number>;
|
|
197
|
+
}
|
|
198
|
+
export type { PaginationOptions, PaginationInfo, PaginatedResponse, } from '../common';
|
|
199
|
+
/**
|
|
200
|
+
* Query filters for messages
|
|
201
|
+
* @interface MessageFilter
|
|
202
|
+
*/
|
|
203
|
+
export interface MessageFilter {
|
|
204
|
+
/** Filter by sender */
|
|
205
|
+
from?: Optional<MessageRecipient>;
|
|
206
|
+
/** Filter by recipient */
|
|
207
|
+
to?: Optional<MessageRecipient>;
|
|
208
|
+
/** Filter by message type */
|
|
209
|
+
messageType?: Optional<MessageType>;
|
|
210
|
+
/** Filter by date range */
|
|
211
|
+
dateRange?: Optional<{
|
|
212
|
+
from: Date;
|
|
213
|
+
to: Date;
|
|
214
|
+
}>;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Type guard to check if a value is a Solana PublicKey string
|
|
218
|
+
* @param value - Value to check
|
|
219
|
+
* @returns True if value is a valid Solana address
|
|
220
|
+
*/
|
|
221
|
+
export declare function isSolanaAddress(value: unknown): value is string;
|
|
222
|
+
/**
|
|
223
|
+
* Type guard to check if a value is an EVM address
|
|
224
|
+
* @param value - Value to check
|
|
225
|
+
* @returns True if value is EVM address string
|
|
226
|
+
*/
|
|
227
|
+
export declare function isEvmAddress(value: unknown): value is string;
|
|
228
|
+
/**
|
|
229
|
+
* Type guard to check if recipient is for Solana
|
|
230
|
+
* @param recipient - Message recipient
|
|
231
|
+
* @returns True if recipient is Solana address
|
|
232
|
+
*/
|
|
233
|
+
export declare function isSolanaRecipient(recipient: MessageRecipient): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Type guard to check if recipient is for EVM
|
|
236
|
+
* @param recipient - Message recipient
|
|
237
|
+
* @returns True if recipient is EVM address
|
|
238
|
+
*/
|
|
239
|
+
export declare function isEvmRecipient(recipient: MessageRecipient): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Protocol constants used across implementations
|
|
242
|
+
*/
|
|
243
|
+
export declare const PROTOCOL_CONSTANTS: {
|
|
244
|
+
/** Base send fee: 0.1 USDC (100,000 with 6 decimals) */
|
|
245
|
+
readonly SEND_FEE: 100000n;
|
|
246
|
+
/** Claim period: 60 days in seconds */
|
|
247
|
+
readonly CLAIM_PERIOD: number;
|
|
248
|
+
/** Revenue share percentages */
|
|
249
|
+
readonly REVENUE_SHARES: {
|
|
250
|
+
readonly SENDER: 90;
|
|
251
|
+
readonly OWNER: 10;
|
|
252
|
+
};
|
|
253
|
+
/** USDC token decimals */
|
|
254
|
+
readonly USDC_DECIMALS: 6;
|
|
255
|
+
/** Maximum message lengths */
|
|
256
|
+
readonly MAX_LENGTHS: {
|
|
257
|
+
readonly SUBJECT: 200;
|
|
258
|
+
readonly BODY: 2000;
|
|
259
|
+
readonly MAIL_ID: 100;
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/blockchain/common.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Common type definitions for multi-chain MailBox system
|
|
4
|
+
* @description Shared types and interfaces for EVM and Solana implementations
|
|
5
|
+
* @author MailBox Team
|
|
6
|
+
* @version 1.4.2
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PROTOCOL_CONSTANTS = exports.TransactionStatus = exports.MessageType = void 0;
|
|
10
|
+
exports.isSolanaAddress = isSolanaAddress;
|
|
11
|
+
exports.isEvmAddress = isEvmAddress;
|
|
12
|
+
exports.isSolanaRecipient = isSolanaRecipient;
|
|
13
|
+
exports.isEvmRecipient = isEvmRecipient;
|
|
14
|
+
/**
|
|
15
|
+
* Message type enumeration
|
|
16
|
+
* @enum MessageType
|
|
17
|
+
*/
|
|
18
|
+
var MessageType;
|
|
19
|
+
(function (MessageType) {
|
|
20
|
+
/** Standard message with 10% fee */
|
|
21
|
+
MessageType["STANDARD"] = "standard";
|
|
22
|
+
/** Priority message with full fee and 90% revenue share */
|
|
23
|
+
MessageType["PRIORITY"] = "priority";
|
|
24
|
+
/** Pre-prepared standard message */
|
|
25
|
+
MessageType["PREPARED_STANDARD"] = "prepared_standard";
|
|
26
|
+
/** Pre-prepared priority message */
|
|
27
|
+
MessageType["PREPARED_PRIORITY"] = "prepared_priority";
|
|
28
|
+
})(MessageType || (exports.MessageType = MessageType = {}));
|
|
29
|
+
/**
|
|
30
|
+
* Transaction status enumeration
|
|
31
|
+
* @enum TransactionStatus
|
|
32
|
+
*/
|
|
33
|
+
var TransactionStatus;
|
|
34
|
+
(function (TransactionStatus) {
|
|
35
|
+
/** Transaction successful */
|
|
36
|
+
TransactionStatus["SUCCESS"] = "success";
|
|
37
|
+
/** Transaction failed */
|
|
38
|
+
TransactionStatus["FAILED"] = "failed";
|
|
39
|
+
/** Transaction pending confirmation */
|
|
40
|
+
TransactionStatus["PENDING"] = "pending";
|
|
41
|
+
})(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// TYPE GUARDS
|
|
44
|
+
// ============================================================================
|
|
45
|
+
/**
|
|
46
|
+
* Type guard to check if a value is a Solana PublicKey string
|
|
47
|
+
* @param value - Value to check
|
|
48
|
+
* @returns True if value is a valid Solana address
|
|
49
|
+
*/
|
|
50
|
+
function isSolanaAddress(value) {
|
|
51
|
+
return (typeof value === 'string' && /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(value));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Type guard to check if a value is an EVM address
|
|
55
|
+
* @param value - Value to check
|
|
56
|
+
* @returns True if value is EVM address string
|
|
57
|
+
*/
|
|
58
|
+
function isEvmAddress(value) {
|
|
59
|
+
return typeof value === 'string' && /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Type guard to check if recipient is for Solana
|
|
63
|
+
* @param recipient - Message recipient
|
|
64
|
+
* @returns True if recipient is Solana address
|
|
65
|
+
*/
|
|
66
|
+
function isSolanaRecipient(recipient) {
|
|
67
|
+
return isSolanaAddress(recipient);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Type guard to check if recipient is for EVM
|
|
71
|
+
* @param recipient - Message recipient
|
|
72
|
+
* @returns True if recipient is EVM address
|
|
73
|
+
*/
|
|
74
|
+
function isEvmRecipient(recipient) {
|
|
75
|
+
return isEvmAddress(recipient);
|
|
76
|
+
}
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// CONSTANTS
|
|
79
|
+
// ============================================================================
|
|
80
|
+
/**
|
|
81
|
+
* Protocol constants used across implementations
|
|
82
|
+
*/
|
|
83
|
+
exports.PROTOCOL_CONSTANTS = {
|
|
84
|
+
/** Base send fee: 0.1 USDC (100,000 with 6 decimals) */
|
|
85
|
+
SEND_FEE: 100000n,
|
|
86
|
+
/** Claim period: 60 days in seconds */
|
|
87
|
+
CLAIM_PERIOD: 60 * 24 * 60 * 60,
|
|
88
|
+
/** Revenue share percentages */
|
|
89
|
+
REVENUE_SHARES: {
|
|
90
|
+
SENDER: 90,
|
|
91
|
+
OWNER: 10,
|
|
92
|
+
},
|
|
93
|
+
/** USDC token decimals */
|
|
94
|
+
USDC_DECIMALS: 6,
|
|
95
|
+
/** Maximum message lengths */
|
|
96
|
+
MAX_LENGTHS: {
|
|
97
|
+
SUBJECT: 200,
|
|
98
|
+
BODY: 2000,
|
|
99
|
+
MAIL_ID: 100,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/types/blockchain/common.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAiRH,0CAIC;AAOD,oCAEC;AAOD,8CAEC;AAOD,wCAEC;AAtOD;;;GAGG;AACH,IAAY,WASX;AATD,WAAY,WAAW;IACrB,oCAAoC;IACpC,oCAAqB,CAAA;IACrB,2DAA2D;IAC3D,oCAAqB,CAAA;IACrB,oCAAoC;IACpC,sDAAuC,CAAA;IACvC,oCAAoC;IACpC,sDAAuC,CAAA;AACzC,CAAC,EATW,WAAW,2BAAX,WAAW,QAStB;AAiHD;;;GAGG;AACH,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,6BAA6B;IAC7B,wCAAmB,CAAA;IACnB,yBAAyB;IACzB,sCAAiB,CAAA;IACjB,uCAAuC;IACvC,wCAAmB,CAAA;AACrB,CAAC,EAPW,iBAAiB,iCAAjB,iBAAiB,QAO5B;AAqDD,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E;;;;GAIG;AACH,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAI,+BAA+B,CAAC,IAAI,CAAC,KAAK,CAAC,CACzE,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,SAA2B;IAC3D,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,SAA2B;IACxD,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC;AAED,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;GAEG;AACU,QAAA,kBAAkB,GAAG;IAChC,wDAAwD;IACxD,QAAQ,EAAE,OAAQ;IAElB,uCAAuC;IACvC,YAAY,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;IAE/B,gCAAgC;IAChC,cAAc,EAAE;QACd,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,EAAE;KACV;IAED,0BAA0B;IAC1B,aAAa,EAAE,CAAC;IAEhB,8BAA8B;IAC9B,WAAW,EAAE;QACX,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,GAAG;KACb;CACO,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateMessage = exports.validateDomain = exports.validateAmount = exports.validateAddress = exports.isSolanaRecipient = exports.isSolanaAddress = exports.isEvmRecipient = exports.isEvmAddress = exports.TransactionStatus = exports.PROTOCOL_CONSTANTS = exports.MessageType = void 0;
|
|
4
|
+
var common_1 = require("./common");
|
|
5
|
+
Object.defineProperty(exports, "MessageType", { enumerable: true, get: function () { return common_1.MessageType; } });
|
|
6
|
+
Object.defineProperty(exports, "PROTOCOL_CONSTANTS", { enumerable: true, get: function () { return common_1.PROTOCOL_CONSTANTS; } });
|
|
7
|
+
Object.defineProperty(exports, "TransactionStatus", { enumerable: true, get: function () { return common_1.TransactionStatus; } });
|
|
8
|
+
Object.defineProperty(exports, "isEvmAddress", { enumerable: true, get: function () { return common_1.isEvmAddress; } });
|
|
9
|
+
Object.defineProperty(exports, "isEvmRecipient", { enumerable: true, get: function () { return common_1.isEvmRecipient; } });
|
|
10
|
+
Object.defineProperty(exports, "isSolanaAddress", { enumerable: true, get: function () { return common_1.isSolanaAddress; } });
|
|
11
|
+
Object.defineProperty(exports, "isSolanaRecipient", { enumerable: true, get: function () { return common_1.isSolanaRecipient; } });
|
|
12
|
+
// Validation types
|
|
13
|
+
var validation_1 = require("./validation");
|
|
14
|
+
Object.defineProperty(exports, "validateAddress", { enumerable: true, get: function () { return validation_1.validateAddress; } });
|
|
15
|
+
Object.defineProperty(exports, "validateAmount", { enumerable: true, get: function () { return validation_1.validateAmount; } });
|
|
16
|
+
Object.defineProperty(exports, "validateDomain", { enumerable: true, get: function () { return validation_1.validateDomain; } });
|
|
17
|
+
Object.defineProperty(exports, "validateMessage", { enumerable: true, get: function () { return validation_1.validateMessage; } });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { ChainConfig, ClaimableRevenue, ClientConfig, DeploymentAddresses, FeeStructure, Message, MessageFilter, MessageRecipient, OperationError, PaginationOptions, PreparedMessage, Result, RpcConfig, SendMessageOptions, TransactionResult, } from './common';
|
|
2
|
+
export { MessageType, PROTOCOL_CONSTANTS, TransactionStatus, isEvmAddress, isEvmRecipient, isSolanaAddress, isSolanaRecipient, } from './common';
|
|
3
|
+
export { validateAddress, validateAmount, validateDomain, validateMessage, } from './validation';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/blockchain/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateMessage = exports.validateDomain = exports.validateAmount = exports.validateAddress = exports.isSolanaRecipient = exports.isSolanaAddress = exports.isEvmRecipient = exports.isEvmAddress = exports.TransactionStatus = exports.PROTOCOL_CONSTANTS = exports.MessageType = void 0;
|
|
4
|
+
var common_1 = require("./common");
|
|
5
|
+
Object.defineProperty(exports, "MessageType", { enumerable: true, get: function () { return common_1.MessageType; } });
|
|
6
|
+
Object.defineProperty(exports, "PROTOCOL_CONSTANTS", { enumerable: true, get: function () { return common_1.PROTOCOL_CONSTANTS; } });
|
|
7
|
+
Object.defineProperty(exports, "TransactionStatus", { enumerable: true, get: function () { return common_1.TransactionStatus; } });
|
|
8
|
+
Object.defineProperty(exports, "isEvmAddress", { enumerable: true, get: function () { return common_1.isEvmAddress; } });
|
|
9
|
+
Object.defineProperty(exports, "isEvmRecipient", { enumerable: true, get: function () { return common_1.isEvmRecipient; } });
|
|
10
|
+
Object.defineProperty(exports, "isSolanaAddress", { enumerable: true, get: function () { return common_1.isSolanaAddress; } });
|
|
11
|
+
Object.defineProperty(exports, "isSolanaRecipient", { enumerable: true, get: function () { return common_1.isSolanaRecipient; } });
|
|
12
|
+
// Validation types
|
|
13
|
+
var validation_1 = require("./validation");
|
|
14
|
+
Object.defineProperty(exports, "validateAddress", { enumerable: true, get: function () { return validation_1.validateAddress; } });
|
|
15
|
+
Object.defineProperty(exports, "validateAmount", { enumerable: true, get: function () { return validation_1.validateAmount; } });
|
|
16
|
+
Object.defineProperty(exports, "validateDomain", { enumerable: true, get: function () { return validation_1.validateDomain; } });
|
|
17
|
+
Object.defineProperty(exports, "validateMessage", { enumerable: true, get: function () { return validation_1.validateMessage; } });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/blockchain/index.ts"],"names":[],"mappings":";;;AAmBA,mCAQkB;AAPhB,qGAAA,WAAW,OAAA;AACX,4GAAA,kBAAkB,OAAA;AAClB,2GAAA,iBAAiB,OAAA;AACjB,sGAAA,YAAY,OAAA;AACZ,wGAAA,cAAc,OAAA;AACd,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AAGnB,mBAAmB;AACnB,2CAKsB;AAJpB,6GAAA,eAAe,OAAA;AACf,4GAAA,cAAc,OAAA;AACd,4GAAA,cAAc,OAAA;AACd,6GAAA,eAAe,OAAA"}
|