@pufferfinance/puffer-sdk 1.7.0 → 1.7.1
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/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.d.ts +3 -2
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js +13 -17
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js.map +1 -1
- package/dist/utils/version.cjs +1 -1
- package/dist/utils/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var h=Object.defineProperty;var C=(n,t,e)=>t in n?h(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var l=(n,t,e)=>C(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../constants-BvU-JhfL.cjs"),m=require("../abis/nucleus-boring-vault-abis.cjs"),p=require("../addresses.cjs"),S=require("../../getContract-MrPLx6gp.cjs");class b{constructor(t,e,a){l(this,"viemChain");this.chain=t,this.walletClient=e,this.publicClient=a,this.viemChain=g.VIEM_CHAINS[t]}getContract(){const t=p.CONTRACT_ADDRESSES[this.chain].NucleusBoringVault,e=m.NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault,a={public:this.publicClient,wallet:this.walletClient};return S.getContract({address:t,abi:e,client:a})}getAllowance(t,e){return this.getContract().read.allowance([t,e])}getTotalSupply(){return this.getContract().read.totalSupply()}balanceOf(t){return this.getContract().read.balanceOf([t])}totalSupply(){return this.getContract().read.totalSupply()}approve(t,e,a){return this.getContract().write.approve([e,a],{account:t,chain:this.viemChain})}transfer(t,e,a){return{transact:()=>this.getContract().write.transfer([e,a],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.transfer([e,a],{account:t})}}transferFrom(t,e,a,r){return{transact:()=>this.getContract().write.transferFrom([e,a,r],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.
|
|
1
|
+
"use strict";var h=Object.defineProperty;var C=(n,t,e)=>t in n?h(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var l=(n,t,e)=>C(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../constants-BvU-JhfL.cjs"),m=require("../abis/nucleus-boring-vault-abis.cjs"),p=require("../addresses.cjs"),S=require("../../getContract-MrPLx6gp.cjs");class b{constructor(t,e,a){l(this,"viemChain");this.chain=t,this.walletClient=e,this.publicClient=a,this.viemChain=g.VIEM_CHAINS[t]}getContract(){const t=p.CONTRACT_ADDRESSES[this.chain].NucleusBoringVault,e=m.NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault,a={public:this.publicClient,wallet:this.walletClient};return S.getContract({address:t,abi:e,client:a})}getAllowance(t,e){return this.getContract().read.allowance([t,e])}getTotalSupply(){return this.getContract().read.totalSupply()}balanceOf(t){return this.getContract().read.balanceOf([t])}totalSupply(){return this.getContract().read.totalSupply()}approve(t,e,a){return this.getContract().write.approve([e,a],{account:t,chain:this.viemChain})}transfer(t,e,a){return{transact:()=>this.getContract().write.transfer([e,a],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.transfer([e,a],{account:t})}}transferFrom(t,e,a,r){return{transact:()=>this.getContract().write.transferFrom([e,a,r],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.transferFrom([e,a,r],{account:t})}}permit(t){const{account:e,owner:a,spender:r,value:i,deadline:c,v:s,r:o,s:u}=t;return{transact:()=>this.getContract().write.permit([a,r,i,c,s,o,u],{account:e,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.permit([a,r,i,c,s,o,u],{account:e})}}}exports.NucleusBoringVaultHandler=b;
|
|
2
2
|
//# sourceMappingURL=nucleus-boring-vault-handler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nucleus-boring-vault-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport { CONTRACT_ADDRESSES } from '../addresses';\n\nexport type PermitParams = {\n owner: Address;\n spender: Address;\n value: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `BoringVault` contract for a given token exposing\n * methods to interact with the contract.\n */\nexport class NucleusBoringVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing UniFi tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain]\n .NucleusBoringVault as Address;\n const abi = NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param owner Address of the owner.\n * @param spender Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check the token balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns Token balance in wei.\n */\n public balanceOf(walletAddress: Address) {\n return this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n walletAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer tokens from the owner's wallet to the given address.\n *\n * @param walletAddress Address of the owner's wallet.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transfer(walletAddress: Address, toAddress: Address, value: bigint) {\n const transact = () =>\n this.getContract().write.transfer([toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transfer([toAddress, value], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Transfer tokens from the given address to another address.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param fromAddress Address to transfer the tokens from.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transferFrom(\n walletAddress: Address,\n fromAddress: Address,\n toAddress: Address,\n value: bigint,\n ) {\n const transact = () =>\n this.getContract().write.transferFrom([fromAddress, toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.
|
|
1
|
+
{"version":3,"file":"nucleus-boring-vault-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport { CONTRACT_ADDRESSES } from '../addresses';\n\nexport type PermitParams = {\n account: Address;\n owner: Address;\n spender: Address;\n value: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `BoringVault` contract for a given token exposing\n * methods to interact with the contract.\n */\nexport class NucleusBoringVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing UniFi tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain]\n .NucleusBoringVault as Address;\n const abi = NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param owner Address of the owner.\n * @param spender Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check the token balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns Token balance in wei.\n */\n public balanceOf(walletAddress: Address) {\n return this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n walletAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer tokens from the owner's wallet to the given address.\n *\n * @param walletAddress Address of the owner's wallet.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transfer(walletAddress: Address, toAddress: Address, value: bigint) {\n const transact = () =>\n this.getContract().write.transfer([toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transfer([toAddress, value], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Transfer tokens from the given address to another address.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param fromAddress Address to transfer the tokens from.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transferFrom(\n walletAddress: Address,\n fromAddress: Address,\n toAddress: Address,\n value: bigint,\n ) {\n const transact = () =>\n this.getContract().write.transferFrom([fromAddress, toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transferFrom(\n [fromAddress, toAddress, value],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Get permit to be able to use the token.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.owner Address of the owner.\n * @param params.spender Address of the spender.\n * @param params.value Value to approve for the spender.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public permit(params: PermitParams) {\n const { account, owner, spender, value, deadline, v, r, s } = params;\n const transact = () =>\n this.getContract().write.permit(\n [owner, spender, value, deadline, v, r, s],\n { account, chain: this.viemChain },\n );\n const estimate = () =>\n this.getContract().estimateGas.permit(\n [owner, spender, value, deadline, v, r, s],\n { account },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusBoringVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","NUCLEUS_BORING_VAULT_ABIS","client","getContract","owner","spender","walletAddress","spenderAddress","value","toAddress","fromAddress","params","account","deadline","v","r","s"],"mappings":"iaA4BO,MAAMA,CAA0B,CAYrC,YACUC,EACAC,EACAC,EACR,CAfMC,EAAA,kBAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,CACpC,CAQO,aAAc,CACnB,MAAMK,EAAUC,EAAA,mBAAmB,KAAK,KAAK,EAC1C,mBACGC,EAAMC,EAAA,0BAA0B,KAAK,KAAK,EAAE,YAC5CC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,cAEzD,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,CAAQ,CAAA,CAK7C,CASO,aAAaE,EAAgBC,EAAkB,CAC7C,OAAA,KAAK,cAAc,KAAK,UAAU,CAACD,EAAOC,CAAO,CAAC,CAC3D,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CAACR,EAAOC,EAASG,EAAOK,EAAUC,EAAGC,EAAGC,CAAC,EACzC,CAAE,QAAAJ,CAAQ,CAAA,EAIhB,CACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { WalletClient, PublicClient, Address, GetContractReturnType } from 'viem';
|
|
2
2
|
import { Chain, ViemChain } from '../../chains/constants';
|
|
3
3
|
export type PermitParams = {
|
|
4
|
+
account: Address;
|
|
4
5
|
owner: Address;
|
|
5
6
|
spender: Address;
|
|
6
7
|
value: bigint;
|
|
@@ -6843,8 +6844,8 @@ export declare class NucleusBoringVaultHandler {
|
|
|
6843
6844
|
/**
|
|
6844
6845
|
* Get permit to be able to use the token.
|
|
6845
6846
|
*
|
|
6846
|
-
* @param walletAddress Address of the caller of the transaction.
|
|
6847
6847
|
* @param params Permit parameters.
|
|
6848
|
+
* @param params.account Address of the caller of the transaction.
|
|
6848
6849
|
* @param params.owner Address of the owner.
|
|
6849
6850
|
* @param params.spender Address of the spender.
|
|
6850
6851
|
* @param params.value Value to approve for the spender.
|
|
@@ -6858,7 +6859,7 @@ export declare class NucleusBoringVaultHandler {
|
|
|
6858
6859
|
* `estimate: () => Promise<bigint>` - Gas estimate of the
|
|
6859
6860
|
* transaction.
|
|
6860
6861
|
*/
|
|
6861
|
-
permit(
|
|
6862
|
+
permit(params: PermitParams): {
|
|
6862
6863
|
transact: () => Promise<`0x${string}`>;
|
|
6863
6864
|
estimate: () => Promise<bigint>;
|
|
6864
6865
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var m = (n, t, a) => t in n ?
|
|
3
|
-
var
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var m = (n, t, a) => t in n ? u(n, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[t] = a;
|
|
3
|
+
var l = (n, t, a) => m(n, typeof t != "symbol" ? t + "" : t, a);
|
|
4
4
|
import { V as C } from "../../constants-rWWWhxR_.js";
|
|
5
5
|
import { NUCLEUS_BORING_VAULT_ABIS as p } from "../abis/nucleus-boring-vault-abis.js";
|
|
6
6
|
import { CONTRACT_ADDRESSES as g } from "../addresses.js";
|
|
@@ -16,7 +16,7 @@ class _ {
|
|
|
16
16
|
* interactions.
|
|
17
17
|
*/
|
|
18
18
|
constructor(t, a, e) {
|
|
19
|
-
|
|
19
|
+
l(this, "viemChain");
|
|
20
20
|
this.chain = t, this.walletClient = a, this.publicClient = e, this.viemChain = C[t];
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -115,15 +115,16 @@ class _ {
|
|
|
115
115
|
return { transact: () => this.getContract().write.transferFrom([a, e, r], {
|
|
116
116
|
account: t,
|
|
117
117
|
chain: this.viemChain
|
|
118
|
-
}), estimate: () => this.getContract().estimateGas.
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
}), estimate: () => this.getContract().estimateGas.transferFrom(
|
|
119
|
+
[a, e, r],
|
|
120
|
+
{ account: t }
|
|
121
|
+
) };
|
|
121
122
|
}
|
|
122
123
|
/**
|
|
123
124
|
* Get permit to be able to use the token.
|
|
124
125
|
*
|
|
125
|
-
* @param walletAddress Address of the caller of the transaction.
|
|
126
126
|
* @param params Permit parameters.
|
|
127
|
+
* @param params.account Address of the caller of the transaction.
|
|
127
128
|
* @param params.owner Address of the owner.
|
|
128
129
|
* @param params.spender Address of the spender.
|
|
129
130
|
* @param params.value Value to approve for the spender.
|
|
@@ -137,19 +138,14 @@ class _ {
|
|
|
137
138
|
* `estimate: () => Promise<bigint>` - Gas estimate of the
|
|
138
139
|
* transaction.
|
|
139
140
|
*/
|
|
140
|
-
permit(t
|
|
141
|
-
const { owner: e, spender: r, value: i, deadline: c, v: s, r: o, s: h } =
|
|
141
|
+
permit(t) {
|
|
142
|
+
const { account: a, owner: e, spender: r, value: i, deadline: c, v: s, r: o, s: h } = t;
|
|
142
143
|
return { transact: () => this.getContract().write.permit(
|
|
143
144
|
[e, r, i, c, s, o, h],
|
|
144
|
-
{
|
|
145
|
-
account: t,
|
|
146
|
-
chain: this.viemChain
|
|
147
|
-
}
|
|
145
|
+
{ account: a, chain: this.viemChain }
|
|
148
146
|
), estimate: () => this.getContract().estimateGas.permit(
|
|
149
147
|
[e, r, i, c, s, o, h],
|
|
150
|
-
{
|
|
151
|
-
account: t
|
|
152
|
-
}
|
|
148
|
+
{ account: a }
|
|
153
149
|
) };
|
|
154
150
|
}
|
|
155
151
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nucleus-boring-vault-handler.js","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport { CONTRACT_ADDRESSES } from '../addresses';\n\nexport type PermitParams = {\n owner: Address;\n spender: Address;\n value: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `BoringVault` contract for a given token exposing\n * methods to interact with the contract.\n */\nexport class NucleusBoringVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing UniFi tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain]\n .NucleusBoringVault as Address;\n const abi = NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param owner Address of the owner.\n * @param spender Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check the token balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns Token balance in wei.\n */\n public balanceOf(walletAddress: Address) {\n return this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n walletAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer tokens from the owner's wallet to the given address.\n *\n * @param walletAddress Address of the owner's wallet.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transfer(walletAddress: Address, toAddress: Address, value: bigint) {\n const transact = () =>\n this.getContract().write.transfer([toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transfer([toAddress, value], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Transfer tokens from the given address to another address.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param fromAddress Address to transfer the tokens from.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transferFrom(\n walletAddress: Address,\n fromAddress: Address,\n toAddress: Address,\n value: bigint,\n ) {\n const transact = () =>\n this.getContract().write.transferFrom([fromAddress, toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.
|
|
1
|
+
{"version":3,"file":"nucleus-boring-vault-handler.js","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport { CONTRACT_ADDRESSES } from '../addresses';\n\nexport type PermitParams = {\n account: Address;\n owner: Address;\n spender: Address;\n value: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `BoringVault` contract for a given token exposing\n * methods to interact with the contract.\n */\nexport class NucleusBoringVaultHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for processing UniFi tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain]\n .NucleusBoringVault as Address;\n const abi = NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param owner Address of the owner.\n * @param spender Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public getTotalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Check the token balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns Token balance in wei.\n */\n public balanceOf(walletAddress: Address) {\n return this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n walletAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer tokens from the owner's wallet to the given address.\n *\n * @param walletAddress Address of the owner's wallet.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transfer(walletAddress: Address, toAddress: Address, value: bigint) {\n const transact = () =>\n this.getContract().write.transfer([toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transfer([toAddress, value], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Transfer tokens from the given address to another address.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param fromAddress Address to transfer the tokens from.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transferFrom(\n walletAddress: Address,\n fromAddress: Address,\n toAddress: Address,\n value: bigint,\n ) {\n const transact = () =>\n this.getContract().write.transferFrom([fromAddress, toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transferFrom(\n [fromAddress, toAddress, value],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Get permit to be able to use the token.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.owner Address of the owner.\n * @param params.spender Address of the spender.\n * @param params.value Value to approve for the spender.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public permit(params: PermitParams) {\n const { account, owner, spender, value, deadline, v, r, s } = params;\n const transact = () =>\n this.getContract().write.permit(\n [owner, spender, value, deadline, v, r, s],\n { account, chain: this.viemChain },\n );\n const estimate = () =>\n this.getContract().estimateGas.permit(\n [owner, spender, value, deadline, v, r, s],\n { account },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusBoringVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","NUCLEUS_BORING_VAULT_ABIS","client","getContract","owner","spender","walletAddress","spenderAddress","value","toAddress","fromAddress","params","account","deadline","v","r","s"],"mappings":";;;;;;;AA4BO,MAAMA,EAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYrC,YACUC,GACAC,GACAC,GACR;AAfM,IAAAC,EAAA;AAYE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK;AAAA,EACpC;AAAA;AAAA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1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="1.7.0",o=e;exports.version=o;
|
|
2
2
|
//# sourceMappingURL=version.cjs.map
|
package/dist/utils/version.js
CHANGED
package/package.json
CHANGED