@verified-network/verified-sdk 2.2.3 → 2.2.5
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/contract/amm/margin/index.d.ts +1 -1
- package/dist/contract/amm/margin/index.js +2 -2
- package/dist/contract/amm/primary/index.d.ts +1 -1
- package/dist/contract/amm/primary/index.js +2 -2
- package/dist/contract/amm/secondary/index.d.ts +1 -1
- package/dist/contract/amm/secondary/index.js +2 -2
- package/dist/contract/bond/index.d.ts +1 -1
- package/dist/contract/bond/index.js +2 -2
- package/dist/contract/cash/index.d.ts +1 -1
- package/dist/contract/cash/index.js +2 -2
- package/dist/contract/client/index.d.ts +1 -1
- package/dist/contract/client/index.js +2 -2
- package/dist/contract/custody/index.d.ts +1 -1
- package/dist/contract/custody/index.js +2 -2
- package/dist/contract/distribution/index.d.ts +1 -1
- package/dist/contract/distribution/index.js +2 -2
- package/dist/contract/erc20/index.d.ts +1 -1
- package/dist/contract/erc20/index.js +2 -2
- package/dist/contract/factory/index.d.ts +1 -1
- package/dist/contract/factory/index.js +2 -2
- package/dist/contract/index.d.ts +4 -2
- package/dist/contract/index.js +23 -11
- package/dist/contract/liquidity/index.d.ts +1 -1
- package/dist/contract/liquidity/index.js +2 -2
- package/dist/contract/loans/compound/index.d.ts +1 -1
- package/dist/contract/loans/compound/index.js +2 -2
- package/dist/contract/pool/index.d.ts +1 -1
- package/dist/contract/pool/index.js +2 -2
- package/dist/contract/rates/index.d.ts +1 -1
- package/dist/contract/rates/index.js +2 -2
- package/dist/contract/securitiesfactory/index.d.ts +1 -1
- package/dist/contract/securitiesfactory/index.js +2 -2
- package/dist/contract/security/index.d.ts +1 -1
- package/dist/contract/security/index.js +2 -2
- package/dist/contract/token/index.d.ts +1 -1
- package/dist/contract/token/index.js +2 -2
- package/dist/utils/constants.js +3 -2
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
|
|
|
3
3
|
export default class MarginIssueManager extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, contractNetworkAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -24,8 +24,8 @@ class MarginIssueManager extends index_1.VerifiedContract {
|
|
|
24
24
|
super(address, JSON.stringify(MarginIssueManager_json_1.abi), signer);
|
|
25
25
|
this.contractAddress = address;
|
|
26
26
|
}
|
|
27
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
28
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
27
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
28
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
29
29
|
}
|
|
30
30
|
async issueProduct(security, securityType, currency, cficode, securityAmount, minOrderSize, currencyAmount, margin, collateral, tradeFee, options) {
|
|
31
31
|
await this.validateInput(index_1.DATATYPES.ADDRESS, security);
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
|
|
|
3
3
|
export default class PrimaryIssueManager extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, platformAddress: string, platform: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -29,8 +29,8 @@ class PrimaryIssueManager extends index_1.VerifiedContract {
|
|
|
29
29
|
super(address, JSON.stringify(abiKyber), signer);
|
|
30
30
|
this.contractAddress = address;
|
|
31
31
|
}
|
|
32
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
33
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
32
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
33
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
34
34
|
}
|
|
35
35
|
async offer(owned, isin, offered, tomatch, desired, min, issuer, docs, options) {
|
|
36
36
|
await this.validateInput(index_1.DATATYPES.ADDRESS, owned);
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
|
|
|
3
3
|
export default class SecondaryIssueManager extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, contractNetworkAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -22,8 +22,8 @@ class SecondaryIssueManager extends index_1.VerifiedContract {
|
|
|
22
22
|
super(address, JSON.stringify(SecondaryIssueManager_json_1.abi), signer);
|
|
23
23
|
this.contractAddress = address;
|
|
24
24
|
}
|
|
25
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
26
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
25
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
26
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
27
27
|
}
|
|
28
28
|
async issueSecondary(security, currency, securityOutstanding, securityAmount, minOrderSize, currencyAmount, options) {
|
|
29
29
|
await this.validateInput(index_1.DATATYPES.ADDRESS, security);
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
|
|
|
3
3
|
export default class Bond extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, bondCurrencyAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -35,8 +35,8 @@ class Bond extends index_1.VerifiedContract {
|
|
|
35
35
|
super(address, JSON.stringify(Bond_json_1.abi), signer);
|
|
36
36
|
this.contractAddress = address;
|
|
37
37
|
}
|
|
38
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
39
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
38
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
39
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
40
40
|
}
|
|
41
41
|
async requestIssue(_amount, _payer, _currency, _cashContract, options) {
|
|
42
42
|
await this.validateInput(index_1.DATATYPES.NUMBER, _amount);
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
|
|
|
3
3
|
export default class Cash extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, currencyAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -32,8 +32,8 @@ class Cash extends index_1.VerifiedContract {
|
|
|
32
32
|
super(address, JSON.stringify(Cash_json_1.abi), signer);
|
|
33
33
|
this.contractAddress = address;
|
|
34
34
|
}
|
|
35
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
36
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
35
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
36
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Request pay out [callable by manager]
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
|
|
|
3
3
|
export default class Client extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, contractNetworkAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -32,8 +32,8 @@ class Client extends index_1.VerifiedContract {
|
|
|
32
32
|
super(address, JSON.stringify(Client_json_1.abi), signer);
|
|
33
33
|
this.contractAddress = address;
|
|
34
34
|
}
|
|
35
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
36
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
35
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
36
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
37
37
|
}
|
|
38
38
|
async setSigner(_address, options) {
|
|
39
39
|
await this.validateInput(index_1.DATATYPES.ADDRESS, _address);
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
|
|
|
3
3
|
export default class Custody extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, contractNetworkAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -35,8 +35,8 @@ class Custody extends index_1.VerifiedContract {
|
|
|
35
35
|
super(address, JSON.stringify(Vault_json_1.abi), signer);
|
|
36
36
|
this.contractAddress = address;
|
|
37
37
|
}
|
|
38
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
39
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
38
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
39
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
40
40
|
}
|
|
41
41
|
async createVault(_creator, _id, options) {
|
|
42
42
|
await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
|
|
|
3
3
|
export default class Distribution extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, contractNetworkAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -22,8 +22,8 @@ class Distribution extends index_1.VerifiedContract {
|
|
|
22
22
|
super(address, JSON.stringify(Distribution_json_1.abi), signer);
|
|
23
23
|
this.contractAddress = address;
|
|
24
24
|
}
|
|
25
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
26
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
25
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
26
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
Shares fee income with revenue shareholders
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
|
|
|
3
3
|
export default class ERC20 extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, contractNetworkAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -24,8 +24,8 @@ class ERC20 extends index_1.VerifiedContract {
|
|
|
24
24
|
super(address, JSON.stringify(ERC20_json_1.abi), signer);
|
|
25
25
|
this.contractAddress = address;
|
|
26
26
|
}
|
|
27
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
28
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
27
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
28
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
29
29
|
}
|
|
30
30
|
async name() {
|
|
31
31
|
return this.callContract(FUNCTIONS.NAME);
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
|
|
|
3
3
|
export default class Factory extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, contractNetworkAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -30,8 +30,8 @@ class Factory extends index_1.VerifiedContract {
|
|
|
30
30
|
super(address, JSON.stringify(Factory_json_1.abi), signer);
|
|
31
31
|
this.contractAddress = address;
|
|
32
32
|
}
|
|
33
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
34
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
33
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
34
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Get number of tokens [callable by client]
|
package/dist/contract/index.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export type Options = {
|
|
|
24
24
|
gasPrice?: number;
|
|
25
25
|
gasLimit?: number;
|
|
26
26
|
paymentToken?: string;
|
|
27
|
+
apiKey?: string;
|
|
28
|
+
rpcUrl?: string;
|
|
27
29
|
};
|
|
28
30
|
export declare class VerifiedContract {
|
|
29
31
|
private signer;
|
|
@@ -57,9 +59,9 @@ export declare class VerifiedContract {
|
|
|
57
59
|
/** Constructs and call function as userop for biconomy gassless(sponsored/erc20 mode) */
|
|
58
60
|
callFunctionAsUserOp(smartAccount: any, tx: any, functionName: string, paymentToken: string, ...args: any): Promise<SCResponse>;
|
|
59
61
|
/** Constructs and call function using MEE client that allows gas payment in ERC20 tokens */
|
|
60
|
-
callFunctionWithMEEClient(nexusAccount: any, chainId: number, tx: any, paymentToken: `0x${string}
|
|
62
|
+
callFunctionWithMEEClient(nexusAccount: any, chainId: number, tx: any, paymentToken: `0x${string}`, _apiKey?: string): Promise<SCResponse>;
|
|
61
63
|
callContract(functionName: string, ...args: any): Promise<SCResponse>;
|
|
62
|
-
getQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
64
|
+
getQuote(paymentTokenAddress: string, functionName: string, args: any[], rpc?: string, _apiKey?: string): Promise<{
|
|
63
65
|
tokenAddress: string;
|
|
64
66
|
amount: string;
|
|
65
67
|
amountInWei: string;
|
package/dist/contract/index.js
CHANGED
|
@@ -404,13 +404,14 @@ class VerifiedContract {
|
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
/** Constructs and call function using MEE client that allows gas payment in ERC20 tokens */
|
|
407
|
-
async callFunctionWithMEEClient(nexusAccount, chainId, tx, paymentToken) {
|
|
407
|
+
async callFunctionWithMEEClient(nexusAccount, chainId, tx, paymentToken, _apiKey) {
|
|
408
408
|
var _a, _b, _c;
|
|
409
409
|
let res = {};
|
|
410
410
|
let txHash = "";
|
|
411
411
|
try {
|
|
412
412
|
const meeClient = await (0, abstractjs_1.createMeeClient)({
|
|
413
413
|
account: nexusAccount,
|
|
414
|
+
apiKey: _apiKey || constants_1.PaymasterConstants.MEE_API_KEY,
|
|
414
415
|
});
|
|
415
416
|
const transactionInstruction = await nexusAccount.build({
|
|
416
417
|
type: "default",
|
|
@@ -475,7 +476,7 @@ class VerifiedContract {
|
|
|
475
476
|
}
|
|
476
477
|
}
|
|
477
478
|
async callContract(functionName, ...args) {
|
|
478
|
-
var _a, _b, _c, _d, _e, _f;
|
|
479
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
479
480
|
// Check if the function is a read function
|
|
480
481
|
if (this.isReadFunction(functionName)) {
|
|
481
482
|
console.log("read function will use ethers");
|
|
@@ -527,18 +528,24 @@ class VerifiedContract {
|
|
|
527
528
|
chains_1.baseSepolia,
|
|
528
529
|
]) === null || _c === void 0 ? void 0 : _c.map((nt) => nt === null || nt === void 0 ? void 0 : nt.id)) === null || _d === void 0 ? void 0 : _d.join(", ")}`);
|
|
529
530
|
}
|
|
531
|
+
const prov = this.signer.provider;
|
|
532
|
+
const rpcUrl = (_e = prov === null || prov === void 0 ? void 0 : prov.connection) === null || _e === void 0 ? void 0 : _e.url;
|
|
530
533
|
const nexusAccount = await (0, abstractjs_1.toMultichainNexusAccount)({
|
|
531
534
|
chains: [chainToUse],
|
|
532
|
-
transports: [
|
|
535
|
+
transports: [
|
|
536
|
+
(0, viem_1.http)(rpcUrl ||
|
|
537
|
+
((_f = optionsRaw[0]) === null || _f === void 0 ? void 0 : _f.rpcUrl) ||
|
|
538
|
+
((_g = constants_1.PaymasterConstants[Number(chainId)]) === null || _g === void 0 ? void 0 : _g.RPC_URL)),
|
|
539
|
+
],
|
|
533
540
|
signer: _signer,
|
|
534
541
|
});
|
|
535
542
|
const meeAddress = nexusAccount.addressOn(chainId);
|
|
536
543
|
// console.log("nexus account address: ", meeAddress);
|
|
537
|
-
return await this.callFunctionWithMEEClient(nexusAccount, chainId, tx1, (
|
|
544
|
+
return await this.callFunctionWithMEEClient(nexusAccount, chainId, tx1, (_h = optionsRaw[0]) === null || _h === void 0 ? void 0 : _h.paymentToken, (_j = optionsRaw[0]) === null || _j === void 0 ? void 0 : _j.apiKey);
|
|
538
545
|
}
|
|
539
546
|
else {
|
|
540
547
|
console.log("Using Userop since no payment token...");
|
|
541
|
-
const paymentToken = ((
|
|
548
|
+
const paymentToken = ((_k = options[0]) === null || _k === void 0 ? void 0 : _k.paymentToken) ||
|
|
542
549
|
constants_1.PaymasterConstants[`${chainId}`]["PAYMENT_TOKEN"] ||
|
|
543
550
|
"";
|
|
544
551
|
return await this.callFunctionAsUserOp(smartAccount, tx1, functionName, paymentToken, ...args);
|
|
@@ -546,12 +553,12 @@ class VerifiedContract {
|
|
|
546
553
|
}
|
|
547
554
|
else {
|
|
548
555
|
//call contract through normal ether.js
|
|
549
|
-
console.log("gassless not supported will use ethers");
|
|
556
|
+
console.log("gassless not supported will use ethers...");
|
|
550
557
|
return await this.callFunctionWithEthers(functionName, ...args);
|
|
551
558
|
}
|
|
552
559
|
}
|
|
553
|
-
async getQuote(paymentTokenAddress, functionName, args) {
|
|
554
|
-
var _a, _b;
|
|
560
|
+
async getQuote(paymentTokenAddress, functionName, args, rpc, _apiKey) {
|
|
561
|
+
var _a, _b, _c, _d;
|
|
555
562
|
const chainId = await this.signer.getChainId();
|
|
556
563
|
if (this.supportsGasless(chainId)) {
|
|
557
564
|
const _signer = this.signer;
|
|
@@ -564,9 +571,13 @@ class VerifiedContract {
|
|
|
564
571
|
chains_1.baseSepolia,
|
|
565
572
|
].find((nt) => Number(nt === null || nt === void 0 ? void 0 : nt.id) === Number(chainId));
|
|
566
573
|
if (chainToUse) {
|
|
574
|
+
const prov = this.signer.provider;
|
|
575
|
+
const rpcUrl = (_a = prov.connection) === null || _a === void 0 ? void 0 : _a.url;
|
|
567
576
|
const nexusAccount = await (0, abstractjs_1.toMultichainNexusAccount)({
|
|
568
577
|
chains: [chainToUse],
|
|
569
|
-
transports: [
|
|
578
|
+
transports: [
|
|
579
|
+
(0, viem_1.http)(rpcUrl || rpc || ((_b = constants_1.PaymasterConstants[Number(chainId)]) === null || _b === void 0 ? void 0 : _b.RPC_URL)),
|
|
580
|
+
],
|
|
570
581
|
signer: _signer,
|
|
571
582
|
});
|
|
572
583
|
if (paymentTokenAddress) {
|
|
@@ -580,6 +591,7 @@ class VerifiedContract {
|
|
|
580
591
|
};
|
|
581
592
|
const meeClient = await (0, abstractjs_1.createMeeClient)({
|
|
582
593
|
account: nexusAccount,
|
|
594
|
+
apiKey: _apiKey || constants_1.PaymasterConstants.MEE_API_KEY,
|
|
583
595
|
});
|
|
584
596
|
const transactionInstruction = await nexusAccount.build({
|
|
585
597
|
type: "default",
|
|
@@ -603,10 +615,10 @@ class VerifiedContract {
|
|
|
603
615
|
};
|
|
604
616
|
}
|
|
605
617
|
catch (err) {
|
|
606
|
-
if ((
|
|
618
|
+
if ((_c = err === null || err === void 0 ? void 0 : err.message) === null || _c === void 0 ? void 0 : _c.includes("fn is not a function")) {
|
|
607
619
|
console.error(`Function ${functionName} not found in contract's ABI`);
|
|
608
620
|
}
|
|
609
|
-
else if ((
|
|
621
|
+
else if ((_d = err === null || err === void 0 ? void 0 : err.message) === null || _d === void 0 ? void 0 : _d.includes("code=INVALID_ARGUMENT")) {
|
|
610
622
|
console.error(`Invalid arguments type`);
|
|
611
623
|
}
|
|
612
624
|
console.error((err === null || err === void 0 ? void 0 : err.message) || "getQuote failed.");
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
|
|
|
3
3
|
export default class LiquidityContract extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, contractNetworkAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -37,8 +37,8 @@ class LiquidityContract extends index_1.VerifiedContract {
|
|
|
37
37
|
super(address, JSON.stringify(Liquidity_json_1.abi), signer);
|
|
38
38
|
this.contractAddress = address;
|
|
39
39
|
}
|
|
40
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
41
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
40
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
41
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
Creates supply of the Verified Liquidity token after initial issue with constructor defined parameters
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
|
|
|
3
3
|
export default class Compound extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, contractNetworkAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -17,8 +17,8 @@ class Compound extends index_1.VerifiedContract {
|
|
|
17
17
|
super(address, JSON.stringify(VerifiedMarkets_json_1.abi), signer);
|
|
18
18
|
this.contractAddress = address;
|
|
19
19
|
}
|
|
20
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
21
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
20
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
21
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
22
22
|
}
|
|
23
23
|
setSigner(_address) {
|
|
24
24
|
return this.callContract(FUNCTIONS.SETSIGNER, _address);
|
|
@@ -24,7 +24,7 @@ type Funds = {
|
|
|
24
24
|
export default class PoolContract extends VerifiedContract {
|
|
25
25
|
contractAddress: string;
|
|
26
26
|
constructor(signer: VerifiedWallet);
|
|
27
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
27
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
28
28
|
tokenAddress: string;
|
|
29
29
|
amount: string;
|
|
30
30
|
amountInWei: string;
|
|
@@ -21,8 +21,8 @@ class PoolContract extends index_1.VerifiedContract {
|
|
|
21
21
|
super(address, JSON.stringify(Vault_json_1.abi), signer);
|
|
22
22
|
this.contractAddress = address;
|
|
23
23
|
}
|
|
24
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
25
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
24
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
25
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
26
26
|
}
|
|
27
27
|
async swap(_swap, _funds, _limit, _deadline, options) {
|
|
28
28
|
const { poolId, kind, assetIn, assetOut, amount, userData } = _swap;
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
|
|
|
3
3
|
export default class Rates extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, contractNetworkAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -19,8 +19,8 @@ class Rates extends index_1.VerifiedContract {
|
|
|
19
19
|
super(address, JSON.stringify(Rates_json_1.abi), signer);
|
|
20
20
|
this.contractAddress = address;
|
|
21
21
|
}
|
|
22
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
23
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
22
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
23
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
24
24
|
}
|
|
25
25
|
async setFeeTo(_feeTo, _fee, _feeType, options) {
|
|
26
26
|
await this.validateInput(index_1.DATATYPES.ADDRESS, _feeTo);
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
|
|
|
3
3
|
export default class SecuritiesFactory extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, contractNetworkAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -28,8 +28,8 @@ class SecuritiesFactory extends index_1.VerifiedContract {
|
|
|
28
28
|
super(address, JSON.stringify(SecuritiesFactory_json_1.abi), signer);
|
|
29
29
|
this.contractAddress = address;
|
|
30
30
|
}
|
|
31
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
32
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
31
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
32
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
Sets signer to verify bridge
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
|
|
|
3
3
|
export default class Security extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, tokenAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -40,8 +40,8 @@ class Security extends index_1.VerifiedContract {
|
|
|
40
40
|
super(address, JSON.stringify(Security_json_1.abi), signer);
|
|
41
41
|
this.contractAddress = address;
|
|
42
42
|
}
|
|
43
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
44
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
43
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
44
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
45
45
|
}
|
|
46
46
|
async whiteList(_spender, _amount, options) {
|
|
47
47
|
await this.validateInput(index_1.DATATYPES.ADDRESS, _spender);
|
|
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
|
|
|
3
3
|
export default class Token extends VerifiedContract {
|
|
4
4
|
contractAddress: string;
|
|
5
5
|
constructor(signer: VerifiedWallet, bondCurrencyAddress: string);
|
|
6
|
-
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[]): Promise<{
|
|
6
|
+
_getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
|
|
7
7
|
tokenAddress: string;
|
|
8
8
|
amount: string;
|
|
9
9
|
amountInWei: string;
|
|
@@ -27,8 +27,8 @@ class Token extends index_1.VerifiedContract {
|
|
|
27
27
|
super(address, JSON.stringify(Token_json_1.abi), signer);
|
|
28
28
|
this.contractAddress = address;
|
|
29
29
|
}
|
|
30
|
-
async _getMeeQuote(paymentTokenAddress, functionName, args) {
|
|
31
|
-
return await this.getQuote(paymentTokenAddress, functionName, args);
|
|
30
|
+
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
31
|
+
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Lend by purchasing bond token against other cash token [callable by client]
|
package/dist/utils/constants.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.PaymasterConstants = {
|
|
|
6
6
|
MAX_WAITING_ROUND: 10, //number of rounds gassless transactions will wait to fetch receipt. Note: each round is 6 seconds, so 10 for example is 1 minute
|
|
7
7
|
BUNDLER_URL_FIRST_SECTION: "https://bundler.biconomy.io/api/v2",
|
|
8
8
|
GENERAL_PAYMASTER_URL: "https://paymaster.biconomy.io/api/v1",
|
|
9
|
+
MEE_API_KEY: "mee_XGE8XYuTujTdkB4sohJMHv",
|
|
9
10
|
BICONOMY_REVERT_TOPIC: "0x1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201",
|
|
10
11
|
//ethereum sepolia
|
|
11
12
|
11155111: {
|
|
@@ -30,13 +31,13 @@ exports.PaymasterConstants = {
|
|
|
30
31
|
1: {
|
|
31
32
|
PAYMASTER_API_KEY: "ap7LOqALI.bf68e672-47ce-40f8-8b62-ea508dcf5852",
|
|
32
33
|
BUNDLER_API_KEY: "dewj402.wh1289hU-7E49-85b-af80-t6XmQ4yJs",
|
|
33
|
-
RPC_URL: "https://eth-mainnet.
|
|
34
|
+
RPC_URL: "https://eth-mainnet.public.blastapi.io",
|
|
34
35
|
},
|
|
35
36
|
//base mainnet
|
|
36
37
|
8453: {
|
|
37
38
|
PAYMASTER_API_KEY: "glRQsmuYh.5d9372ab-5063-4ecd-ac63-643fef624a73",
|
|
38
39
|
BUNDLER_API_KEY: "dewj402.wh1289hU-7E49-85b-af80-t6XmQ4yJs",
|
|
39
|
-
RPC_URL: "https://mainnet.
|
|
40
|
+
RPC_URL: "https://base-mainnet.public.blastapi.io",
|
|
40
41
|
},
|
|
41
42
|
//gnosis
|
|
42
43
|
100: {
|