@sudobility/contracts 1.13.1 → 1.13.3
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/evm/src/evm/evm-mailer-client.js +3 -3
- package/dist/evm/src/evm/evm-mailer-client.js.map +1 -1
- package/dist/evm/src/evm/index.d.ts +3 -3
- package/dist/evm/src/evm/index.d.ts.map +1 -1
- package/dist/evm/src/evm/index.js +4 -4
- package/dist/evm/src/evm/index.js.map +1 -1
- package/dist/solana/solana/index.d.ts +2 -2
- package/dist/solana/solana/index.d.ts.map +1 -1
- package/dist/solana/solana/index.js +3 -3
- package/dist/solana/solana/index.js.map +1 -1
- package/dist/solana/solana/solana-mailer-client.d.ts +1 -1
- package/dist/solana/solana/solana-mailer-client.d.ts.map +1 -1
- package/dist/solana/solana/solana-mailer-client.js +1 -1
- package/dist/solana/solana/solana-mailer-client.js.map +1 -1
- package/dist/solana/solana/types.d.ts +1 -1
- package/dist/solana/solana/types.d.ts.map +1 -1
- package/dist/solana/solana/types.js +5 -5
- package/dist/solana/solana/types.js.map +1 -1
- package/dist/unified/src/evm/evm-mailer-client.js +7 -11
- package/dist/unified/src/evm/evm-mailer-client.js.map +1 -1
- package/dist/unified/src/evm/index.d.ts +3 -3
- package/dist/unified/src/evm/index.d.ts.map +1 -1
- package/dist/unified/src/evm/index.js +2 -7
- package/dist/unified/src/evm/index.js.map +1 -1
- package/dist/unified/src/react/context/MailerProvider.js +14 -55
- package/dist/unified/src/react/context/MailerProvider.js.map +1 -1
- package/dist/unified/src/react/hooks/useMailerMutations.js +76 -98
- package/dist/unified/src/react/hooks/useMailerMutations.js.map +1 -1
- package/dist/unified/src/react/hooks/useMailerQueries.js +52 -68
- package/dist/unified/src/react/hooks/useMailerQueries.js.map +1 -1
- package/dist/unified/src/react/index.js +5 -47
- package/dist/unified/src/react/index.js.map +1 -1
- package/dist/unified/src/solana/index.d.ts +2 -2
- package/dist/unified/src/solana/index.d.ts.map +1 -1
- package/dist/unified/src/solana/index.js +2 -20
- package/dist/unified/src/solana/index.js.map +1 -1
- package/dist/unified/src/solana/solana-mailer-client.d.ts +1 -1
- package/dist/unified/src/solana/solana-mailer-client.d.ts.map +1 -1
- package/dist/unified/src/solana/solana-mailer-client.js +129 -133
- package/dist/unified/src/solana/solana-mailer-client.js.map +1 -1
- package/dist/unified/src/solana/types.d.ts +1 -1
- package/dist/unified/src/solana/types.d.ts.map +1 -1
- package/dist/unified/src/solana/types.js +6 -13
- package/dist/unified/src/solana/types.js.map +1 -1
- package/dist/unified/src/unified/index.d.ts +3 -3
- package/dist/unified/src/unified/index.d.ts.map +1 -1
- package/dist/unified/src/unified/index.js +2 -7
- package/dist/unified/src/unified/index.js.map +1 -1
- package/dist/unified/src/unified/onchain-mailer-client.d.ts +35 -35
- package/dist/unified/src/unified/onchain-mailer-client.d.ts.map +1 -1
- package/dist/unified/src/unified/onchain-mailer-client.js +88 -125
- package/dist/unified/src/unified/onchain-mailer-client.js.map +1 -1
- package/dist/unified/src/unified/types.js +1 -2
- package/dist/unified/src/unified/wallet-detector.js +10 -14
- package/dist/unified/src/unified/wallet-detector.js.map +1 -1
- package/dist/unified/src/utils/chain-config.d.ts +1 -1
- package/dist/unified/src/utils/chain-config.d.ts.map +1 -1
- package/dist/unified/src/utils/chain-config.js +9 -13
- package/dist/unified/src/utils/chain-config.js.map +1 -1
- package/dist/unified/src/utils/currency.js +6 -11
- package/dist/unified/src/utils/currency.js.map +1 -1
- package/dist/unified/src/utils/index.d.ts +3 -3
- package/dist/unified/src/utils/index.d.ts.map +1 -1
- package/dist/unified/src/utils/index.js +3 -19
- package/dist/unified/src/utils/index.js.map +1 -1
- package/dist/unified/src/utils/validation.js +11 -17
- package/dist/unified/src/utils/validation.js.map +1 -1
- package/dist/unified/typechain-types/Mailer.js +1 -2
- package/dist/unified/typechain-types/MockUSDC.js +1 -2
- package/dist/unified/typechain-types/common.js +1 -2
- package/dist/unified/typechain-types/factories/Mailer__factory.js +4 -8
- package/dist/unified/typechain-types/factories/Mailer__factory.js.map +1 -1
- package/dist/unified/typechain-types/factories/MockUSDC__factory.js +4 -8
- package/dist/unified/typechain-types/factories/MockUSDC__factory.js.map +1 -1
- package/dist/unified/typechain-types/factories/index.js +3 -41
- package/dist/unified/typechain-types/factories/index.js.map +1 -1
- package/dist/unified/typechain-types/factories/interfaces/IERC20__factory.js +4 -8
- package/dist/unified/typechain-types/factories/interfaces/IERC20__factory.js.map +1 -1
- package/dist/unified/typechain-types/factories/interfaces/index.js +1 -5
- package/dist/unified/typechain-types/factories/interfaces/index.js.map +1 -1
- package/dist/unified/typechain-types/index.js +4 -43
- package/dist/unified/typechain-types/index.js.map +1 -1
- package/dist/unified/typechain-types/interfaces/IERC20.js +1 -2
- package/dist/unified/typechain-types/interfaces/index.js +1 -2
- package/package.json +12 -18
- package/dist/unified/package.json +0 -3
- package/dist/unified-esm/src/evm/evm-mailer-client.d.ts +0 -1062
- package/dist/unified-esm/src/evm/evm-mailer-client.d.ts.map +0 -1
- package/dist/unified-esm/src/evm/evm-mailer-client.js +0 -920
- package/dist/unified-esm/src/evm/evm-mailer-client.js.map +0 -1
- package/dist/unified-esm/src/evm/index.d.ts +0 -4
- package/dist/unified-esm/src/evm/index.d.ts.map +0 -1
- package/dist/unified-esm/src/evm/index.js +0 -5
- package/dist/unified-esm/src/evm/index.js.map +0 -1
- package/dist/unified-esm/src/react/context/MailerProvider.d.ts +0 -108
- package/dist/unified-esm/src/react/context/MailerProvider.d.ts.map +0 -1
- package/dist/unified-esm/src/react/context/MailerProvider.js +0 -119
- package/dist/unified-esm/src/react/context/MailerProvider.js.map +0 -1
- package/dist/unified-esm/src/react/hooks/useMailerMutations.d.ts +0 -334
- package/dist/unified-esm/src/react/hooks/useMailerMutations.d.ts.map +0 -1
- package/dist/unified-esm/src/react/hooks/useMailerMutations.js +0 -392
- package/dist/unified-esm/src/react/hooks/useMailerMutations.js.map +0 -1
- package/dist/unified-esm/src/react/hooks/useMailerQueries.d.ts +0 -184
- package/dist/unified-esm/src/react/hooks/useMailerQueries.d.ts.map +0 -1
- package/dist/unified-esm/src/react/hooks/useMailerQueries.js +0 -316
- package/dist/unified-esm/src/react/hooks/useMailerQueries.js.map +0 -1
- package/dist/unified-esm/src/react/index.d.ts +0 -39
- package/dist/unified-esm/src/react/index.d.ts.map +0 -1
- package/dist/unified-esm/src/react/index.js +0 -43
- package/dist/unified-esm/src/react/index.js.map +0 -1
- package/dist/unified-esm/src/solana/index.d.ts +0 -3
- package/dist/unified-esm/src/solana/index.d.ts.map +0 -1
- package/dist/unified-esm/src/solana/index.js +0 -4
- package/dist/unified-esm/src/solana/index.js.map +0 -1
- package/dist/unified-esm/src/solana/solana-mailer-client.d.ts +0 -209
- package/dist/unified-esm/src/solana/solana-mailer-client.d.ts.map +0 -1
- package/dist/unified-esm/src/solana/solana-mailer-client.js +0 -1000
- package/dist/unified-esm/src/solana/solana-mailer-client.js.map +0 -1
- package/dist/unified-esm/src/solana/types.d.ts +0 -29
- package/dist/unified-esm/src/solana/types.d.ts.map +0 -1
- package/dist/unified-esm/src/solana/types.js +0 -16
- package/dist/unified-esm/src/solana/types.js.map +0 -1
- package/dist/unified-esm/src/unified/index.d.ts +0 -4
- package/dist/unified-esm/src/unified/index.d.ts.map +0 -1
- package/dist/unified-esm/src/unified/index.js +0 -4
- package/dist/unified-esm/src/unified/index.js.map +0 -1
- package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts +0 -258
- package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts.map +0 -1
- package/dist/unified-esm/src/unified/onchain-mailer-client.js +0 -731
- package/dist/unified-esm/src/unified/onchain-mailer-client.js.map +0 -1
- package/dist/unified-esm/src/unified/types.d.ts +0 -54
- package/dist/unified-esm/src/unified/types.d.ts.map +0 -1
- package/dist/unified-esm/src/unified/types.js +0 -2
- package/dist/unified-esm/src/unified/types.js.map +0 -1
- package/dist/unified-esm/src/unified/wallet-detector.d.ts +0 -28
- package/dist/unified-esm/src/unified/wallet-detector.d.ts.map +0 -1
- package/dist/unified-esm/src/unified/wallet-detector.js +0 -59
- package/dist/unified-esm/src/unified/wallet-detector.js.map +0 -1
- package/dist/unified-esm/src/utils/chain-config.d.ts +0 -75
- package/dist/unified-esm/src/utils/chain-config.d.ts.map +0 -1
- package/dist/unified-esm/src/utils/chain-config.js +0 -199
- package/dist/unified-esm/src/utils/chain-config.js.map +0 -1
- package/dist/unified-esm/src/utils/currency.d.ts +0 -26
- package/dist/unified-esm/src/utils/currency.d.ts.map +0 -1
- package/dist/unified-esm/src/utils/currency.js +0 -31
- package/dist/unified-esm/src/utils/currency.js.map +0 -1
- package/dist/unified-esm/src/utils/index.d.ts +0 -4
- package/dist/unified-esm/src/utils/index.d.ts.map +0 -1
- package/dist/unified-esm/src/utils/index.js +0 -4
- package/dist/unified-esm/src/utils/index.js.map +0 -1
- package/dist/unified-esm/src/utils/validation.d.ts +0 -10
- package/dist/unified-esm/src/utils/validation.d.ts.map +0 -1
- package/dist/unified-esm/src/utils/validation.js +0 -96
- package/dist/unified-esm/src/utils/validation.js.map +0 -1
- package/dist/unified-esm/typechain-types/Mailer.d.ts +0 -698
- package/dist/unified-esm/typechain-types/Mailer.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/Mailer.js +0 -2
- package/dist/unified-esm/typechain-types/Mailer.js.map +0 -1
- package/dist/unified-esm/typechain-types/MockUSDC.d.ts +0 -118
- package/dist/unified-esm/typechain-types/MockUSDC.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/MockUSDC.js +0 -2
- package/dist/unified-esm/typechain-types/MockUSDC.js.map +0 -1
- package/dist/unified-esm/typechain-types/common.d.ts +0 -51
- package/dist/unified-esm/typechain-types/common.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/common.js +0 -2
- package/dist/unified-esm/typechain-types/common.js.map +0 -1
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts +0 -875
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.js +0 -1121
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.js.map +0 -1
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.d.ts +0 -193
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.js +0 -259
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.js.map +0 -1
- package/dist/unified-esm/typechain-types/factories/index.d.ts +0 -4
- package/dist/unified-esm/typechain-types/factories/index.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/factories/index.js +0 -7
- package/dist/unified-esm/typechain-types/factories/index.js.map +0 -1
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.d.ts +0 -80
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.js +0 -112
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.js.map +0 -1
- package/dist/unified-esm/typechain-types/factories/interfaces/index.d.ts +0 -2
- package/dist/unified-esm/typechain-types/factories/interfaces/index.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/factories/interfaces/index.js +0 -5
- package/dist/unified-esm/typechain-types/factories/interfaces/index.js.map +0 -1
- package/dist/unified-esm/typechain-types/index.d.ts +0 -10
- package/dist/unified-esm/typechain-types/index.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/index.js +0 -5
- package/dist/unified-esm/typechain-types/index.js.map +0 -1
- package/dist/unified-esm/typechain-types/interfaces/IERC20.d.ts +0 -70
- package/dist/unified-esm/typechain-types/interfaces/IERC20.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/interfaces/IERC20.js +0 -2
- package/dist/unified-esm/typechain-types/interfaces/IERC20.js.map +0 -1
- package/dist/unified-esm/typechain-types/interfaces/index.d.ts +0 -2
- package/dist/unified-esm/typechain-types/interfaces/index.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/interfaces/index.js +0 -2
- package/dist/unified-esm/typechain-types/interfaces/index.js.map +0 -1
|
@@ -1,42 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.OnchainMailerClient = void 0;
|
|
37
1
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
38
2
|
// @ts-nocheck - Suppress false TypeScript errors with ESNext modules accessing class properties
|
|
39
|
-
|
|
3
|
+
import { ChainType } from '@sudobility/types';
|
|
40
4
|
/**
|
|
41
5
|
* OnchainMailerClient - Stateless multi-chain messaging client
|
|
42
6
|
*
|
|
@@ -85,7 +49,7 @@ const types_1 = require("@sudobility/types");
|
|
|
85
49
|
* );
|
|
86
50
|
* ```
|
|
87
51
|
*/
|
|
88
|
-
class OnchainMailerClient {
|
|
52
|
+
export class OnchainMailerClient {
|
|
89
53
|
/**
|
|
90
54
|
* Create a new stateless OnchainMailerClient
|
|
91
55
|
* No configuration needed in constructor
|
|
@@ -96,14 +60,14 @@ class OnchainMailerClient {
|
|
|
96
60
|
// Performance optimization: cache client imports
|
|
97
61
|
async getEVMClient() {
|
|
98
62
|
if (!OnchainMailerClient.evmClient) {
|
|
99
|
-
const { EVMMailerClient } = await
|
|
63
|
+
const { EVMMailerClient } = await import('../evm/evm-mailer-client.js');
|
|
100
64
|
OnchainMailerClient.evmClient = new EVMMailerClient();
|
|
101
65
|
}
|
|
102
66
|
return OnchainMailerClient.evmClient;
|
|
103
67
|
}
|
|
104
68
|
async getSolanaClient() {
|
|
105
69
|
if (!OnchainMailerClient.solanaClient) {
|
|
106
|
-
const { SolanaMailerClient } = await
|
|
70
|
+
const { SolanaMailerClient } = await import('../solana/solana-mailer-client.js');
|
|
107
71
|
OnchainMailerClient.solanaClient = new SolanaMailerClient();
|
|
108
72
|
}
|
|
109
73
|
return OnchainMailerClient.solanaClient;
|
|
@@ -126,7 +90,7 @@ class OnchainMailerClient {
|
|
|
126
90
|
throw new Error('Body must be 1-10000 characters');
|
|
127
91
|
}
|
|
128
92
|
// Route to appropriate implementation based on chain type
|
|
129
|
-
if (chainInfo.chainType ===
|
|
93
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
130
94
|
const evmClient = await this.getEVMClient();
|
|
131
95
|
const evmWallet = connectedWallet;
|
|
132
96
|
const [account] = await evmWallet.walletClient.getAddresses();
|
|
@@ -138,14 +102,14 @@ class OnchainMailerClient {
|
|
|
138
102
|
resolveSenderToName, options?.gasOptions);
|
|
139
103
|
return {
|
|
140
104
|
transactionHash: result.hash,
|
|
141
|
-
chainType:
|
|
105
|
+
chainType: ChainType.EVM,
|
|
142
106
|
fee: BigInt(priority ? '100000' : '10000'),
|
|
143
107
|
gasUsed: result.gasUsed,
|
|
144
108
|
isPriority: priority,
|
|
145
109
|
success: true
|
|
146
110
|
};
|
|
147
111
|
}
|
|
148
|
-
else if (chainInfo.chainType ===
|
|
112
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
149
113
|
const solanaClient = await this.getSolanaClient();
|
|
150
114
|
const solanaWallet = connectedWallet;
|
|
151
115
|
const to = options?.to || solanaWallet.wallet.publicKey.toBase58();
|
|
@@ -154,7 +118,7 @@ class OnchainMailerClient {
|
|
|
154
118
|
options?.computeOptions);
|
|
155
119
|
return {
|
|
156
120
|
transactionHash: result.transactionHash,
|
|
157
|
-
chainType:
|
|
121
|
+
chainType: ChainType.SOLANA,
|
|
158
122
|
fee: BigInt(priority ? '100000' : '10000'),
|
|
159
123
|
isPriority: priority,
|
|
160
124
|
success: true
|
|
@@ -168,7 +132,7 @@ class OnchainMailerClient {
|
|
|
168
132
|
* Send a prepared message
|
|
169
133
|
*/
|
|
170
134
|
async sendPrepared(connectedWallet, chainInfo, to, mailId, options) {
|
|
171
|
-
if (chainInfo.chainType ===
|
|
135
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
172
136
|
const evmClient = await this.getEVMClient();
|
|
173
137
|
const evmWallet = connectedWallet;
|
|
174
138
|
const [account] = await evmWallet.walletClient.getAddresses();
|
|
@@ -179,21 +143,21 @@ class OnchainMailerClient {
|
|
|
179
143
|
resolveSenderToName, options?.gasOptions);
|
|
180
144
|
return {
|
|
181
145
|
transactionHash: result.hash,
|
|
182
|
-
chainType:
|
|
146
|
+
chainType: ChainType.EVM,
|
|
183
147
|
fee: BigInt(priority ? '100000' : '10000'),
|
|
184
148
|
gasUsed: result.gasUsed,
|
|
185
149
|
isPriority: priority,
|
|
186
150
|
success: true
|
|
187
151
|
};
|
|
188
152
|
}
|
|
189
|
-
else if (chainInfo.chainType ===
|
|
153
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
190
154
|
const solanaClient = await this.getSolanaClient();
|
|
191
155
|
const solanaWallet = connectedWallet;
|
|
192
156
|
const priority = options?.priority ?? false;
|
|
193
157
|
const result = await solanaClient.sendPrepared(solanaWallet, chainInfo, to, mailId, priority, options?.computeOptions);
|
|
194
158
|
return {
|
|
195
159
|
transactionHash: result.transactionHash,
|
|
196
|
-
chainType:
|
|
160
|
+
chainType: ChainType.SOLANA,
|
|
197
161
|
fee: BigInt(priority ? '100000' : '10000'),
|
|
198
162
|
isPriority: priority,
|
|
199
163
|
success: true
|
|
@@ -207,7 +171,7 @@ class OnchainMailerClient {
|
|
|
207
171
|
* Send through webhook
|
|
208
172
|
*/
|
|
209
173
|
async sendThroughWebhook(connectedWallet, chainInfo, to, webhookId, options) {
|
|
210
|
-
if (chainInfo.chainType ===
|
|
174
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
211
175
|
const evmClient = await this.getEVMClient();
|
|
212
176
|
const evmWallet = connectedWallet;
|
|
213
177
|
const [account] = await evmWallet.walletClient.getAddresses();
|
|
@@ -216,21 +180,21 @@ class OnchainMailerClient {
|
|
|
216
180
|
priority, evmWallet, chainInfo, options?.gasOptions);
|
|
217
181
|
return {
|
|
218
182
|
transactionHash: result.hash,
|
|
219
|
-
chainType:
|
|
183
|
+
chainType: ChainType.EVM,
|
|
220
184
|
fee: BigInt(priority ? '100000' : '10000'),
|
|
221
185
|
gasUsed: result.gasUsed,
|
|
222
186
|
isPriority: priority,
|
|
223
187
|
success: true
|
|
224
188
|
};
|
|
225
189
|
}
|
|
226
|
-
else if (chainInfo.chainType ===
|
|
190
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
227
191
|
const solanaClient = await this.getSolanaClient();
|
|
228
192
|
const solanaWallet = connectedWallet;
|
|
229
193
|
const priority = options?.priority ?? false;
|
|
230
194
|
const result = await solanaClient.sendThroughWebhook(solanaWallet, chainInfo, to, webhookId, priority, options?.computeOptions);
|
|
231
195
|
return {
|
|
232
196
|
transactionHash: result.transactionHash,
|
|
233
|
-
chainType:
|
|
197
|
+
chainType: ChainType.SOLANA,
|
|
234
198
|
fee: BigInt(priority ? '100000' : '10000'),
|
|
235
199
|
isPriority: priority,
|
|
236
200
|
success: true
|
|
@@ -248,22 +212,22 @@ class OnchainMailerClient {
|
|
|
248
212
|
* @returns Transaction result
|
|
249
213
|
*/
|
|
250
214
|
async delegateTo(connectedWallet, chainInfo, delegate, options) {
|
|
251
|
-
if (chainInfo.chainType ===
|
|
215
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
252
216
|
const evmClient = await this.getEVMClient();
|
|
253
217
|
const result = await evmClient.delegateTo(delegate, connectedWallet, chainInfo, options?.gasOptions);
|
|
254
218
|
return {
|
|
255
219
|
transactionHash: result.hash,
|
|
256
|
-
chainType:
|
|
220
|
+
chainType: ChainType.EVM,
|
|
257
221
|
delegate,
|
|
258
222
|
success: true
|
|
259
223
|
};
|
|
260
224
|
}
|
|
261
|
-
else if (chainInfo.chainType ===
|
|
225
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
262
226
|
const solanaClient = await this.getSolanaClient();
|
|
263
227
|
const result = await solanaClient.delegateTo(delegate, connectedWallet, chainInfo, options?.computeOptions);
|
|
264
228
|
return {
|
|
265
229
|
transactionHash: result.transactionHash,
|
|
266
|
-
chainType:
|
|
230
|
+
chainType: ChainType.SOLANA,
|
|
267
231
|
delegate,
|
|
268
232
|
success: true
|
|
269
233
|
};
|
|
@@ -276,20 +240,20 @@ class OnchainMailerClient {
|
|
|
276
240
|
* Reject delegation
|
|
277
241
|
*/
|
|
278
242
|
async rejectDelegation(connectedWallet, chainInfo, delegatingAddress, options) {
|
|
279
|
-
if (chainInfo.chainType ===
|
|
243
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
280
244
|
const evmClient = await this.getEVMClient();
|
|
281
245
|
const result = await evmClient.rejectDelegation(connectedWallet, chainInfo, delegatingAddress, options?.gasOptions);
|
|
282
246
|
return {
|
|
283
247
|
hash: result.hash,
|
|
284
|
-
chainType:
|
|
248
|
+
chainType: ChainType.EVM
|
|
285
249
|
};
|
|
286
250
|
}
|
|
287
|
-
else if (chainInfo.chainType ===
|
|
251
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
288
252
|
const solanaClient = await this.getSolanaClient();
|
|
289
253
|
const result = await solanaClient.rejectDelegation(connectedWallet, chainInfo, delegatingAddress, options?.computeOptions);
|
|
290
254
|
return {
|
|
291
255
|
hash: result.transactionHash,
|
|
292
|
-
chainType:
|
|
256
|
+
chainType: ChainType.SOLANA
|
|
293
257
|
};
|
|
294
258
|
}
|
|
295
259
|
else {
|
|
@@ -303,20 +267,20 @@ class OnchainMailerClient {
|
|
|
303
267
|
* @returns Transaction result
|
|
304
268
|
*/
|
|
305
269
|
async claimRevenue(connectedWallet, chainInfo, options) {
|
|
306
|
-
if (chainInfo.chainType ===
|
|
270
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
307
271
|
const evmClient = await this.getEVMClient();
|
|
308
272
|
const result = await evmClient.claimRecipientShare(connectedWallet, chainInfo, options?.gasOptions);
|
|
309
273
|
return {
|
|
310
274
|
hash: result.hash,
|
|
311
|
-
chainType:
|
|
275
|
+
chainType: ChainType.EVM
|
|
312
276
|
};
|
|
313
277
|
}
|
|
314
|
-
else if (chainInfo.chainType ===
|
|
278
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
315
279
|
const solanaClient = await this.getSolanaClient();
|
|
316
280
|
const result = await solanaClient.claimRecipientShare(connectedWallet, chainInfo, options?.computeOptions);
|
|
317
281
|
return {
|
|
318
282
|
hash: result.transactionHash,
|
|
319
|
-
chainType:
|
|
283
|
+
chainType: ChainType.SOLANA
|
|
320
284
|
};
|
|
321
285
|
}
|
|
322
286
|
else {
|
|
@@ -327,20 +291,20 @@ class OnchainMailerClient {
|
|
|
327
291
|
* Claim owner share (owner only)
|
|
328
292
|
*/
|
|
329
293
|
async claimOwnerShare(connectedWallet, chainInfo, options) {
|
|
330
|
-
if (chainInfo.chainType ===
|
|
294
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
331
295
|
const evmClient = await this.getEVMClient();
|
|
332
296
|
const result = await evmClient.claimOwnerShare(connectedWallet, chainInfo, options?.gasOptions);
|
|
333
297
|
return {
|
|
334
298
|
hash: result.hash,
|
|
335
|
-
chainType:
|
|
299
|
+
chainType: ChainType.EVM
|
|
336
300
|
};
|
|
337
301
|
}
|
|
338
|
-
else if (chainInfo.chainType ===
|
|
302
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
339
303
|
const solanaClient = await this.getSolanaClient();
|
|
340
304
|
const result = await solanaClient.claimOwnerShare(connectedWallet, chainInfo, options?.computeOptions);
|
|
341
305
|
return {
|
|
342
306
|
hash: result.transactionHash,
|
|
343
|
-
chainType:
|
|
307
|
+
chainType: ChainType.SOLANA
|
|
344
308
|
};
|
|
345
309
|
}
|
|
346
310
|
else {
|
|
@@ -351,20 +315,20 @@ class OnchainMailerClient {
|
|
|
351
315
|
* Claim expired shares (owner only)
|
|
352
316
|
*/
|
|
353
317
|
async claimExpiredShares(connectedWallet, chainInfo, recipient, options) {
|
|
354
|
-
if (chainInfo.chainType ===
|
|
318
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
355
319
|
const evmClient = await this.getEVMClient();
|
|
356
320
|
const result = await evmClient.claimExpiredShares(recipient, connectedWallet, chainInfo, options?.gasOptions);
|
|
357
321
|
return {
|
|
358
322
|
hash: result.hash,
|
|
359
|
-
chainType:
|
|
323
|
+
chainType: ChainType.EVM
|
|
360
324
|
};
|
|
361
325
|
}
|
|
362
|
-
else if (chainInfo.chainType ===
|
|
326
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
363
327
|
const solanaClient = await this.getSolanaClient();
|
|
364
328
|
const result = await solanaClient.claimExpiredShares(recipient, connectedWallet, chainInfo, options?.computeOptions);
|
|
365
329
|
return {
|
|
366
330
|
hash: result.transactionHash,
|
|
367
|
-
chainType:
|
|
331
|
+
chainType: ChainType.SOLANA
|
|
368
332
|
};
|
|
369
333
|
}
|
|
370
334
|
else {
|
|
@@ -375,22 +339,22 @@ class OnchainMailerClient {
|
|
|
375
339
|
* Set fees (owner only)
|
|
376
340
|
*/
|
|
377
341
|
async setFees(connectedWallet, chainInfo, sendFee, delegationFee, options) {
|
|
378
|
-
if (chainInfo.chainType ===
|
|
342
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
379
343
|
const evmClient = await this.getEVMClient();
|
|
380
344
|
// EVM client uses separate methods
|
|
381
345
|
await evmClient.setFee(connectedWallet, chainInfo, sendFee, options?.gasOptions);
|
|
382
346
|
const result2 = await evmClient.setDelegationFee(connectedWallet, chainInfo, delegationFee, options?.gasOptions);
|
|
383
347
|
return {
|
|
384
348
|
hash: result2.hash, // Return last transaction
|
|
385
|
-
chainType:
|
|
349
|
+
chainType: ChainType.EVM
|
|
386
350
|
};
|
|
387
351
|
}
|
|
388
|
-
else if (chainInfo.chainType ===
|
|
352
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
389
353
|
const solanaClient = await this.getSolanaClient();
|
|
390
354
|
const result = await solanaClient.setFees(connectedWallet, chainInfo, sendFee, delegationFee, options?.computeOptions);
|
|
391
355
|
return {
|
|
392
356
|
hash: result.transactionHash,
|
|
393
|
-
chainType:
|
|
357
|
+
chainType: ChainType.SOLANA
|
|
394
358
|
};
|
|
395
359
|
}
|
|
396
360
|
else {
|
|
@@ -401,20 +365,20 @@ class OnchainMailerClient {
|
|
|
401
365
|
* Set custom fee percentage
|
|
402
366
|
*/
|
|
403
367
|
async setCustomFeePercentage(connectedWallet, chainInfo, target, percentage, options) {
|
|
404
|
-
if (chainInfo.chainType ===
|
|
368
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
405
369
|
const evmClient = await this.getEVMClient();
|
|
406
370
|
const result = await evmClient.setCustomFeePercentage(connectedWallet, chainInfo, target, percentage, options?.gasOptions);
|
|
407
371
|
return {
|
|
408
372
|
hash: result.hash,
|
|
409
|
-
chainType:
|
|
373
|
+
chainType: ChainType.EVM
|
|
410
374
|
};
|
|
411
375
|
}
|
|
412
|
-
else if (chainInfo.chainType ===
|
|
376
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
413
377
|
const solanaClient = await this.getSolanaClient();
|
|
414
378
|
const result = await solanaClient.setCustomFeePercentage(connectedWallet, chainInfo, target, percentage, options?.computeOptions);
|
|
415
379
|
return {
|
|
416
380
|
hash: result.transactionHash,
|
|
417
|
-
chainType:
|
|
381
|
+
chainType: ChainType.SOLANA
|
|
418
382
|
};
|
|
419
383
|
}
|
|
420
384
|
else {
|
|
@@ -425,20 +389,20 @@ class OnchainMailerClient {
|
|
|
425
389
|
* Clear custom fee percentage
|
|
426
390
|
*/
|
|
427
391
|
async clearCustomFeePercentage(connectedWallet, chainInfo, target, options) {
|
|
428
|
-
if (chainInfo.chainType ===
|
|
392
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
429
393
|
const evmClient = await this.getEVMClient();
|
|
430
394
|
const result = await evmClient.clearCustomFeePercentage(connectedWallet, chainInfo, target, options?.gasOptions);
|
|
431
395
|
return {
|
|
432
396
|
hash: result.hash,
|
|
433
|
-
chainType:
|
|
397
|
+
chainType: ChainType.EVM
|
|
434
398
|
};
|
|
435
399
|
}
|
|
436
|
-
else if (chainInfo.chainType ===
|
|
400
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
437
401
|
const solanaClient = await this.getSolanaClient();
|
|
438
402
|
const result = await solanaClient.clearCustomFeePercentage(connectedWallet, chainInfo, target, options?.computeOptions);
|
|
439
403
|
return {
|
|
440
404
|
hash: result.transactionHash,
|
|
441
|
-
chainType:
|
|
405
|
+
chainType: ChainType.SOLANA
|
|
442
406
|
};
|
|
443
407
|
}
|
|
444
408
|
else {
|
|
@@ -449,20 +413,20 @@ class OnchainMailerClient {
|
|
|
449
413
|
* Pause the contract/program (owner only)
|
|
450
414
|
*/
|
|
451
415
|
async pause(connectedWallet, chainInfo, options) {
|
|
452
|
-
if (chainInfo.chainType ===
|
|
416
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
453
417
|
const evmClient = await this.getEVMClient();
|
|
454
418
|
const result = await evmClient.pause(connectedWallet, chainInfo, options?.gasOptions);
|
|
455
419
|
return {
|
|
456
420
|
hash: result.hash,
|
|
457
|
-
chainType:
|
|
421
|
+
chainType: ChainType.EVM
|
|
458
422
|
};
|
|
459
423
|
}
|
|
460
|
-
else if (chainInfo.chainType ===
|
|
424
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
461
425
|
const solanaClient = await this.getSolanaClient();
|
|
462
426
|
const result = await solanaClient.pause(connectedWallet, chainInfo, options?.computeOptions);
|
|
463
427
|
return {
|
|
464
428
|
hash: result.transactionHash,
|
|
465
|
-
chainType:
|
|
429
|
+
chainType: ChainType.SOLANA
|
|
466
430
|
};
|
|
467
431
|
}
|
|
468
432
|
else {
|
|
@@ -473,20 +437,20 @@ class OnchainMailerClient {
|
|
|
473
437
|
* Unpause the contract/program (owner only)
|
|
474
438
|
*/
|
|
475
439
|
async unpause(connectedWallet, chainInfo, options) {
|
|
476
|
-
if (chainInfo.chainType ===
|
|
440
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
477
441
|
const evmClient = await this.getEVMClient();
|
|
478
442
|
const result = await evmClient.unpause(connectedWallet, chainInfo, options?.gasOptions);
|
|
479
443
|
return {
|
|
480
444
|
hash: result.hash,
|
|
481
|
-
chainType:
|
|
445
|
+
chainType: ChainType.EVM
|
|
482
446
|
};
|
|
483
447
|
}
|
|
484
|
-
else if (chainInfo.chainType ===
|
|
448
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
485
449
|
const solanaClient = await this.getSolanaClient();
|
|
486
450
|
const result = await solanaClient.unpause(connectedWallet, chainInfo, options?.computeOptions);
|
|
487
451
|
return {
|
|
488
452
|
hash: result.transactionHash,
|
|
489
|
-
chainType:
|
|
453
|
+
chainType: ChainType.SOLANA
|
|
490
454
|
};
|
|
491
455
|
}
|
|
492
456
|
else {
|
|
@@ -497,20 +461,20 @@ class OnchainMailerClient {
|
|
|
497
461
|
* Emergency unpause (owner only)
|
|
498
462
|
*/
|
|
499
463
|
async emergencyUnpause(connectedWallet, chainInfo, options) {
|
|
500
|
-
if (chainInfo.chainType ===
|
|
464
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
501
465
|
const evmClient = await this.getEVMClient();
|
|
502
466
|
const result = await evmClient.emergencyUnpause(connectedWallet, chainInfo, options?.gasOptions);
|
|
503
467
|
return {
|
|
504
468
|
hash: result.hash,
|
|
505
|
-
chainType:
|
|
469
|
+
chainType: ChainType.EVM
|
|
506
470
|
};
|
|
507
471
|
}
|
|
508
|
-
else if (chainInfo.chainType ===
|
|
472
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
509
473
|
const solanaClient = await this.getSolanaClient();
|
|
510
474
|
const result = await solanaClient.emergencyUnpause(connectedWallet, chainInfo, options?.computeOptions);
|
|
511
475
|
return {
|
|
512
476
|
hash: result.transactionHash,
|
|
513
|
-
chainType:
|
|
477
|
+
chainType: ChainType.SOLANA
|
|
514
478
|
};
|
|
515
479
|
}
|
|
516
480
|
else {
|
|
@@ -522,24 +486,24 @@ class OnchainMailerClient {
|
|
|
522
486
|
* Note: EVM supports single recipient, Solana supports multiple
|
|
523
487
|
*/
|
|
524
488
|
async distributeClaimableFunds(connectedWallet, chainInfo, recipient, options) {
|
|
525
|
-
if (chainInfo.chainType ===
|
|
489
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
526
490
|
const evmClient = await this.getEVMClient();
|
|
527
491
|
// EVM only supports single recipient
|
|
528
492
|
const singleRecipient = Array.isArray(recipient) ? recipient[0] : recipient;
|
|
529
493
|
const result = await evmClient.distributeClaimableFunds(connectedWallet, chainInfo, singleRecipient, options?.gasOptions);
|
|
530
494
|
return {
|
|
531
495
|
hash: result.hash,
|
|
532
|
-
chainType:
|
|
496
|
+
chainType: ChainType.EVM
|
|
533
497
|
};
|
|
534
498
|
}
|
|
535
|
-
else if (chainInfo.chainType ===
|
|
499
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
536
500
|
const solanaClient = await this.getSolanaClient();
|
|
537
501
|
// Solana supports multiple recipients
|
|
538
502
|
const recipients = Array.isArray(recipient) ? recipient : [recipient];
|
|
539
503
|
const result = await solanaClient.distributeClaimableFunds(connectedWallet, chainInfo, recipients, options?.computeOptions);
|
|
540
504
|
return {
|
|
541
505
|
hash: result.transactionHash,
|
|
542
|
-
chainType:
|
|
506
|
+
chainType: ChainType.SOLANA
|
|
543
507
|
};
|
|
544
508
|
}
|
|
545
509
|
else {
|
|
@@ -551,15 +515,15 @@ class OnchainMailerClient {
|
|
|
551
515
|
* Note: Only supported on EVM chains
|
|
552
516
|
*/
|
|
553
517
|
async setPermission(connectedWallet, chainInfo, contractAddress, options) {
|
|
554
|
-
if (chainInfo.chainType ===
|
|
518
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
555
519
|
const evmClient = await this.getEVMClient();
|
|
556
520
|
const result = await evmClient.setPermission(connectedWallet, chainInfo, contractAddress, options?.gasOptions);
|
|
557
521
|
return {
|
|
558
522
|
hash: result.hash,
|
|
559
|
-
chainType:
|
|
523
|
+
chainType: ChainType.EVM
|
|
560
524
|
};
|
|
561
525
|
}
|
|
562
|
-
else if (chainInfo.chainType ===
|
|
526
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
563
527
|
throw new Error('Permission system is not supported on Solana');
|
|
564
528
|
}
|
|
565
529
|
else {
|
|
@@ -571,15 +535,15 @@ class OnchainMailerClient {
|
|
|
571
535
|
* Note: Only supported on EVM chains
|
|
572
536
|
*/
|
|
573
537
|
async removePermission(connectedWallet, chainInfo, contractAddress, options) {
|
|
574
|
-
if (chainInfo.chainType ===
|
|
538
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
575
539
|
const evmClient = await this.getEVMClient();
|
|
576
540
|
const result = await evmClient.removePermission(connectedWallet, chainInfo, contractAddress, options?.gasOptions);
|
|
577
541
|
return {
|
|
578
542
|
hash: result.hash,
|
|
579
|
-
chainType:
|
|
543
|
+
chainType: ChainType.EVM
|
|
580
544
|
};
|
|
581
545
|
}
|
|
582
|
-
else if (chainInfo.chainType ===
|
|
546
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
583
547
|
throw new Error('Permission system is not supported on Solana');
|
|
584
548
|
}
|
|
585
549
|
else {
|
|
@@ -591,11 +555,11 @@ class OnchainMailerClient {
|
|
|
591
555
|
* Note: Only supported on EVM chains
|
|
592
556
|
*/
|
|
593
557
|
async hasPermission(chainInfo, contractAddress, walletAddress, publicClient) {
|
|
594
|
-
if (chainInfo.chainType ===
|
|
558
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
595
559
|
const evmClient = await this.getEVMClient();
|
|
596
560
|
return await evmClient.hasPermission(chainInfo, contractAddress, walletAddress, publicClient);
|
|
597
561
|
}
|
|
598
|
-
else if (chainInfo.chainType ===
|
|
562
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
599
563
|
// Solana doesn't have permission system, always return false
|
|
600
564
|
return false;
|
|
601
565
|
}
|
|
@@ -612,11 +576,11 @@ class OnchainMailerClient {
|
|
|
612
576
|
* @returns Fee amount in USDC micro-units
|
|
613
577
|
*/
|
|
614
578
|
async getSendFee(chainInfo, publicClient, connection) {
|
|
615
|
-
if (chainInfo.chainType ===
|
|
579
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
616
580
|
const evmClient = await this.getEVMClient();
|
|
617
581
|
return await evmClient.getSendFee(chainInfo, publicClient);
|
|
618
582
|
}
|
|
619
|
-
else if (chainInfo.chainType ===
|
|
583
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
620
584
|
const solanaClient = await this.getSolanaClient();
|
|
621
585
|
return await solanaClient.getSendFee(chainInfo, connection);
|
|
622
586
|
}
|
|
@@ -628,11 +592,11 @@ class OnchainMailerClient {
|
|
|
628
592
|
* Get delegation fee
|
|
629
593
|
*/
|
|
630
594
|
async getDelegationFee(chainInfo, publicClient, connection) {
|
|
631
|
-
if (chainInfo.chainType ===
|
|
595
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
632
596
|
const evmClient = await this.getEVMClient();
|
|
633
597
|
return await evmClient.getDelegationFee(chainInfo, publicClient);
|
|
634
598
|
}
|
|
635
|
-
else if (chainInfo.chainType ===
|
|
599
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
636
600
|
const solanaClient = await this.getSolanaClient();
|
|
637
601
|
return await solanaClient.getDelegationFee(chainInfo, connection);
|
|
638
602
|
}
|
|
@@ -649,12 +613,12 @@ class OnchainMailerClient {
|
|
|
649
613
|
* @returns Delegated address or null
|
|
650
614
|
*/
|
|
651
615
|
async getDelegation(address, chainInfo, publicClient, connection) {
|
|
652
|
-
if (chainInfo.chainType ===
|
|
616
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
653
617
|
const evmClient = await this.getEVMClient();
|
|
654
618
|
const delegation = await evmClient.getDelegation(address, chainInfo, publicClient);
|
|
655
619
|
return delegation === '0x0000000000000000000000000000000000000000' ? null : delegation;
|
|
656
620
|
}
|
|
657
|
-
else if (chainInfo.chainType ===
|
|
621
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
658
622
|
const solanaClient = await this.getSolanaClient();
|
|
659
623
|
const delegation = await solanaClient.getDelegation(address, chainInfo, connection);
|
|
660
624
|
return delegation ? delegation.toBase58() : null;
|
|
@@ -667,11 +631,11 @@ class OnchainMailerClient {
|
|
|
667
631
|
* Get recipient claimable info
|
|
668
632
|
*/
|
|
669
633
|
async getRecipientClaimable(recipient, chainInfo, publicClient, connection) {
|
|
670
|
-
if (chainInfo.chainType ===
|
|
634
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
671
635
|
const evmClient = await this.getEVMClient();
|
|
672
636
|
return await evmClient.getRecipientClaimable(recipient, chainInfo, publicClient);
|
|
673
637
|
}
|
|
674
|
-
else if (chainInfo.chainType ===
|
|
638
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
675
639
|
const solanaClient = await this.getSolanaClient();
|
|
676
640
|
const info = await solanaClient.getRecipientClaimable(recipient, chainInfo, connection);
|
|
677
641
|
if (!info)
|
|
@@ -690,11 +654,11 @@ class OnchainMailerClient {
|
|
|
690
654
|
* Get owner claimable amount
|
|
691
655
|
*/
|
|
692
656
|
async getOwnerClaimable(chainInfo, publicClient, connection) {
|
|
693
|
-
if (chainInfo.chainType ===
|
|
657
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
694
658
|
const evmClient = await this.getEVMClient();
|
|
695
659
|
return await evmClient.getOwnerClaimable(chainInfo, publicClient);
|
|
696
660
|
}
|
|
697
|
-
else if (chainInfo.chainType ===
|
|
661
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
698
662
|
const solanaClient = await this.getSolanaClient();
|
|
699
663
|
const amount = await solanaClient.getOwnerClaimable(chainInfo, connection);
|
|
700
664
|
return BigInt(amount);
|
|
@@ -707,11 +671,11 @@ class OnchainMailerClient {
|
|
|
707
671
|
* Get custom fee percentage
|
|
708
672
|
*/
|
|
709
673
|
async getCustomFeePercentage(target, chainInfo, publicClient, connection) {
|
|
710
|
-
if (chainInfo.chainType ===
|
|
674
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
711
675
|
const evmClient = await this.getEVMClient();
|
|
712
676
|
return await evmClient.getCustomFeePercentage(target, chainInfo, publicClient);
|
|
713
677
|
}
|
|
714
|
-
else if (chainInfo.chainType ===
|
|
678
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
715
679
|
const solanaClient = await this.getSolanaClient();
|
|
716
680
|
return await solanaClient.getCustomFeePercentage(target, chainInfo, connection);
|
|
717
681
|
}
|
|
@@ -723,11 +687,11 @@ class OnchainMailerClient {
|
|
|
723
687
|
* Check if contract/program is paused
|
|
724
688
|
*/
|
|
725
689
|
async isPaused(chainInfo, publicClient, connection) {
|
|
726
|
-
if (chainInfo.chainType ===
|
|
690
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
727
691
|
const evmClient = await this.getEVMClient();
|
|
728
692
|
return await evmClient.isPaused(chainInfo, publicClient);
|
|
729
693
|
}
|
|
730
|
-
else if (chainInfo.chainType ===
|
|
694
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
731
695
|
const solanaClient = await this.getSolanaClient();
|
|
732
696
|
return await solanaClient.isPaused(chainInfo, connection);
|
|
733
697
|
}
|
|
@@ -739,11 +703,11 @@ class OnchainMailerClient {
|
|
|
739
703
|
* Get contract/program owner
|
|
740
704
|
*/
|
|
741
705
|
async getOwner(chainInfo, publicClient, connection) {
|
|
742
|
-
if (chainInfo.chainType ===
|
|
706
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
743
707
|
const evmClient = await this.getEVMClient();
|
|
744
708
|
return await evmClient.getOwner(chainInfo, publicClient);
|
|
745
709
|
}
|
|
746
|
-
else if (chainInfo.chainType ===
|
|
710
|
+
else if (chainInfo.chainType === ChainType.SOLANA) {
|
|
747
711
|
const solanaClient = await this.getSolanaClient();
|
|
748
712
|
const owner = await solanaClient.getOwner(chainInfo, connection);
|
|
749
713
|
return owner.toBase58();
|
|
@@ -759,7 +723,6 @@ class OnchainMailerClient {
|
|
|
759
723
|
throw new Error('Domain registration not yet implemented');
|
|
760
724
|
}
|
|
761
725
|
}
|
|
762
|
-
exports.OnchainMailerClient = OnchainMailerClient;
|
|
763
726
|
// Cache for dynamic imports
|
|
764
727
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
765
728
|
OnchainMailerClient.evmClient = null;
|