@verified-network/verified-sdk 2.2.4 → 2.2.6
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 +25 -12
- 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 +2 -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,14 +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: constants_1.PaymasterConstants.MEE_API_KEY,
|
|
414
|
+
apiKey: _apiKey || constants_1.PaymasterConstants.MEE_API_KEY,
|
|
415
415
|
});
|
|
416
416
|
const transactionInstruction = await nexusAccount.build({
|
|
417
417
|
type: "default",
|
|
@@ -427,6 +427,7 @@ class VerifiedContract {
|
|
|
427
427
|
address: paymentToken,
|
|
428
428
|
},
|
|
429
429
|
instructions: [transactionInstruction],
|
|
430
|
+
upperBoundTimestamp: Date.now() + 3600, //1hour ???
|
|
430
431
|
});
|
|
431
432
|
txHash = hash;
|
|
432
433
|
console.log(`MEE transaction hash: ${hash}`);
|
|
@@ -476,7 +477,7 @@ class VerifiedContract {
|
|
|
476
477
|
}
|
|
477
478
|
}
|
|
478
479
|
async callContract(functionName, ...args) {
|
|
479
|
-
var _a, _b, _c, _d, _e, _f;
|
|
480
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
480
481
|
// Check if the function is a read function
|
|
481
482
|
if (this.isReadFunction(functionName)) {
|
|
482
483
|
console.log("read function will use ethers");
|
|
@@ -528,18 +529,24 @@ class VerifiedContract {
|
|
|
528
529
|
chains_1.baseSepolia,
|
|
529
530
|
]) === 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(", ")}`);
|
|
530
531
|
}
|
|
532
|
+
const prov = this.signer.provider;
|
|
533
|
+
const rpcUrl = (_e = prov === null || prov === void 0 ? void 0 : prov.connection) === null || _e === void 0 ? void 0 : _e.url;
|
|
531
534
|
const nexusAccount = await (0, abstractjs_1.toMultichainNexusAccount)({
|
|
532
535
|
chains: [chainToUse],
|
|
533
|
-
transports: [
|
|
536
|
+
transports: [
|
|
537
|
+
(0, viem_1.http)(rpcUrl ||
|
|
538
|
+
((_f = optionsRaw[0]) === null || _f === void 0 ? void 0 : _f.rpcUrl) ||
|
|
539
|
+
((_g = constants_1.PaymasterConstants[Number(chainId)]) === null || _g === void 0 ? void 0 : _g.RPC_URL)),
|
|
540
|
+
],
|
|
534
541
|
signer: _signer,
|
|
535
542
|
});
|
|
536
543
|
const meeAddress = nexusAccount.addressOn(chainId);
|
|
537
544
|
// console.log("nexus account address: ", meeAddress);
|
|
538
|
-
return await this.callFunctionWithMEEClient(nexusAccount, chainId, tx1, (
|
|
545
|
+
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);
|
|
539
546
|
}
|
|
540
547
|
else {
|
|
541
548
|
console.log("Using Userop since no payment token...");
|
|
542
|
-
const paymentToken = ((
|
|
549
|
+
const paymentToken = ((_k = options[0]) === null || _k === void 0 ? void 0 : _k.paymentToken) ||
|
|
543
550
|
constants_1.PaymasterConstants[`${chainId}`]["PAYMENT_TOKEN"] ||
|
|
544
551
|
"";
|
|
545
552
|
return await this.callFunctionAsUserOp(smartAccount, tx1, functionName, paymentToken, ...args);
|
|
@@ -551,8 +558,9 @@ class VerifiedContract {
|
|
|
551
558
|
return await this.callFunctionWithEthers(functionName, ...args);
|
|
552
559
|
}
|
|
553
560
|
}
|
|
554
|
-
async getQuote(paymentTokenAddress, functionName, args) {
|
|
555
|
-
var _a, _b;
|
|
561
|
+
async getQuote(paymentTokenAddress, functionName, args, rpc, _apiKey) {
|
|
562
|
+
var _a, _b, _c, _d;
|
|
563
|
+
console.log(paymentTokenAddress, functionName, args, rpc, _apiKey);
|
|
556
564
|
const chainId = await this.signer.getChainId();
|
|
557
565
|
if (this.supportsGasless(chainId)) {
|
|
558
566
|
const _signer = this.signer;
|
|
@@ -565,9 +573,13 @@ class VerifiedContract {
|
|
|
565
573
|
chains_1.baseSepolia,
|
|
566
574
|
].find((nt) => Number(nt === null || nt === void 0 ? void 0 : nt.id) === Number(chainId));
|
|
567
575
|
if (chainToUse) {
|
|
576
|
+
const prov = this.signer.provider;
|
|
577
|
+
const rpcUrl = (_a = prov.connection) === null || _a === void 0 ? void 0 : _a.url;
|
|
568
578
|
const nexusAccount = await (0, abstractjs_1.toMultichainNexusAccount)({
|
|
569
579
|
chains: [chainToUse],
|
|
570
|
-
transports: [
|
|
580
|
+
transports: [
|
|
581
|
+
(0, viem_1.http)(rpcUrl || rpc || ((_b = constants_1.PaymasterConstants[Number(chainId)]) === null || _b === void 0 ? void 0 : _b.RPC_URL)),
|
|
582
|
+
],
|
|
571
583
|
signer: _signer,
|
|
572
584
|
});
|
|
573
585
|
if (paymentTokenAddress) {
|
|
@@ -581,7 +593,7 @@ class VerifiedContract {
|
|
|
581
593
|
};
|
|
582
594
|
const meeClient = await (0, abstractjs_1.createMeeClient)({
|
|
583
595
|
account: nexusAccount,
|
|
584
|
-
apiKey: constants_1.PaymasterConstants.MEE_API_KEY,
|
|
596
|
+
apiKey: _apiKey || constants_1.PaymasterConstants.MEE_API_KEY,
|
|
585
597
|
});
|
|
586
598
|
const transactionInstruction = await nexusAccount.build({
|
|
587
599
|
type: "default",
|
|
@@ -595,6 +607,7 @@ class VerifiedContract {
|
|
|
595
607
|
instructions: [transactionInstruction],
|
|
596
608
|
feeToken: { address: tkAddress, chainId },
|
|
597
609
|
});
|
|
610
|
+
// console.log("cont quote: ", quote);
|
|
598
611
|
return {
|
|
599
612
|
tokenAddress: paymentTokenAddress,
|
|
600
613
|
amount: quote === null || quote === void 0 ? void 0 : quote.paymentInfo.tokenAmount,
|
|
@@ -605,10 +618,10 @@ class VerifiedContract {
|
|
|
605
618
|
};
|
|
606
619
|
}
|
|
607
620
|
catch (err) {
|
|
608
|
-
if ((
|
|
621
|
+
if ((_c = err === null || err === void 0 ? void 0 : err.message) === null || _c === void 0 ? void 0 : _c.includes("fn is not a function")) {
|
|
609
622
|
console.error(`Function ${functionName} not found in contract's ABI`);
|
|
610
623
|
}
|
|
611
|
-
else if ((
|
|
624
|
+
else if ((_d = err === null || err === void 0 ? void 0 : err.message) === null || _d === void 0 ? void 0 : _d.includes("code=INVALID_ARGUMENT")) {
|
|
612
625
|
console.error(`Invalid arguments type`);
|
|
613
626
|
}
|
|
614
627
|
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
|
@@ -31,13 +31,13 @@ exports.PaymasterConstants = {
|
|
|
31
31
|
1: {
|
|
32
32
|
PAYMASTER_API_KEY: "ap7LOqALI.bf68e672-47ce-40f8-8b62-ea508dcf5852",
|
|
33
33
|
BUNDLER_API_KEY: "dewj402.wh1289hU-7E49-85b-af80-t6XmQ4yJs",
|
|
34
|
-
RPC_URL: "https://eth-mainnet.
|
|
34
|
+
RPC_URL: "https://eth-mainnet.public.blastapi.io",
|
|
35
35
|
},
|
|
36
36
|
//base mainnet
|
|
37
37
|
8453: {
|
|
38
38
|
PAYMASTER_API_KEY: "glRQsmuYh.5d9372ab-5063-4ecd-ac63-643fef624a73",
|
|
39
39
|
BUNDLER_API_KEY: "dewj402.wh1289hU-7E49-85b-af80-t6XmQ4yJs",
|
|
40
|
-
RPC_URL: "https://mainnet.
|
|
40
|
+
RPC_URL: "https://base-mainnet.public.blastapi.io",
|
|
41
41
|
},
|
|
42
42
|
//gnosis
|
|
43
43
|
100: {
|