Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lens-network/sdk

Package Overview
Dependencies
Maintainers
0
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lens-network/sdk - npm Package Compare versions

Comparing version 0.0.0-canary-20240627133053 to 0.0.0-canary-20240627144825

96

dist/ethers/index.d.ts

@@ -758,11 +758,24 @@ import { ethers, JsonRpcPayload, JsonRpcResult, JsonRpcError } from 'ethers';

};
type Erc721TokenParams = {
initialOwner: string;
maxSupply: ethers.BigNumberish;
name: string;
symbol: string;
};
declare const Wallet_base: {
new (...args: any[]): {
/**
* Create an ERC-20 token with the given parameters.
* Create an ERC-20 contract with the given parameters.
*
* @params params - The parameters to create the ERC-20 token.
* @params params - The parameters to create the ERC-20 contract.
* @returns The ERC-20 contract address.
*/
createErc20(params: Erc20TokenParams): Promise<string>;
/**
* Create an ERC-721 contract with the given parameters.
*
* @params params - The parameters to create the ERC-721 contract.
* @returns The ERC-721 contract address.
*/
createErc721(params: Erc721TokenParams): Promise<string>;
sendTransaction(tx: ethers.TransactionRequest): Promise<ethers.TransactionResponse>;

@@ -801,2 +814,22 @@ getAddress(): Promise<string>;

/**
* @inheritdoc
*
* @example
* ```ts
* import { getDefaultProvider, Network, Wallet } from '@lens-network/sdk/ethers';
*
* const provider = getDefaultProvider(Network.Staging);
*
* const wallet = new Wallet(process.env.PRIVATE_KEY, provider);
*
* const address = await wallet.createErc721({
* initialOwner: wallet.address,
* maxSupply: 100,
* name: 'My Collection',
* symbol: 'SDK',
* });
* ```
*/
createErc721(params: Erc721TokenParams): Promise<string>;
/**
* Connects to the Lens Network using `provider`.

@@ -823,8 +856,15 @@ *

/**
* Create an ERC-20 token with the given parameters.
* Create an ERC-20 contract with the given parameters.
*
* @params params - The parameters to create the ERC-20 token.
* @params params - The parameters to create the ERC-20 contract.
* @returns The ERC-20 contract address.
*/
createErc20(params: Erc20TokenParams): Promise<string>;
/**
* Create an ERC-721 contract with the given parameters.
*
* @params params - The parameters to create the ERC-721 contract.
* @returns The ERC-721 contract address.
*/
createErc721(params: Erc721TokenParams): Promise<string>;
sendTransaction(tx: ethers.TransactionRequest): Promise<ethers.TransactionResponse>;

@@ -848,10 +888,17 @@ getAddress(): Promise<string>;

* ```ts
* import { getDefaultProvider, Network, Wallet } from '@lens-network/sdk/ethers';
* import { BrowserProvider, getDefaultProvider, Network } from '@lens-network/sdk/ethers';
*
* const provider = getDefaultProvider(Network.Staging);
* const browserProvider = new BrowserProvider(window.ethereum);
* const lensProvider = getDefaultProvider(Network.Staging);
*
* const wallet = new Wallet(process.env.PRIVATE_KEY, provider);
* const network = await browserProvider.getNetwork();
*
* const address = await wallet.createErc20({
* initialOwner: wallet.address,
* const signer = Signer.from(
* await browserProvider.getSigner(),
* Number(network.chainId),
* lensProvider,
* );
*
* const address = await signer.createErc20({
* initialOwner: signer.address,
* initialSupply: 100_000_000_000_000_000_000n,

@@ -865,2 +912,29 @@ * name: 'SDK Test Token',

/**
* @inheritdoc
*
* @example
* ```ts
* import { BrowserProvider, getDefaultProvider, Network } from '@lens-network/sdk/ethers';
*
* const browserProvider = new BrowserProvider(window.ethereum);
* const lensProvider = getDefaultProvider(Network.Staging);
*
* const network = await browserProvider.getNetwork();
*
* const signer = Signer.from(
* await browserProvider.getSigner(),
* Number(network.chainId),
* lensProvider,
* );
*
* const address = await signer.createErc721({
* initialOwner: signer.address,
* maxSupply: 100,
* name: 'My Collection',
* symbol: 'SDK',
* });
* ```
*/
createErc721(params: Erc721TokenParams): Promise<string>;
/**
* Creates a new Singer with provided `signer` and `chainId`.

@@ -876,3 +950,3 @@ *

* ```ts
* import { BrowserProvider, Network } from '@lens-network/sdk/ethers';
* import { BrowserProvider, getDefaultProvider, Network } from '@lens-network/sdk/ethers';
*

@@ -896,2 +970,2 @@ * const browserProvider = new BrowserProvider(window.ethereum);

export { BrowserProvider, type ContractCreationResponse, type ContractsCreationResult, type DeployedContracts, type Erc20TokenParams, Network, type OptimisticLog, PagingResult, Provider, SecondsSinceEpoch, type SendRawTransactionDetails, Signer, type StorageEntry, TimeDirection, type TokenInfoResult, type TokenTxHistoryItem, type TokenTxHistoryResponse, type TxHistoryItem, type TxHistoryResponse, Wallet, chains, getDefaultProvider };
export { BrowserProvider, type ContractCreationResponse, type ContractsCreationResult, type DeployedContracts, type Erc20TokenParams, type Erc721TokenParams, Network, type OptimisticLog, PagingResult, Provider, SecondsSinceEpoch, type SendRawTransactionDetails, Signer, type StorageEntry, TimeDirection, type TokenInfoResult, type TokenTxHistoryItem, type TokenTxHistoryResponse, type TxHistoryItem, type TxHistoryResponse, Wallet, chains, getDefaultProvider };

6

dist/ethers/index.js
import { Network, Interface, Contract, NetworkPlugin, assert, EventLog } from 'ethers';
import * as c from 'zksync-ethers';
import * as m from 'zksync-ethers';
import { toBeHex } from 'ethers/utils';
var S=Object.defineProperty;var R=(n,e)=>{for(var t in e)S(n,t,{get:e[t],enumerable:!0});};var s={id:37111,name:"Lens Development Network",network:"lens-development-network",rpcUrl:"https://rpc.staging.lens-network.crtlkey.com/",blockExplorerUrl:"https://explorer.staging.lens.zksync.dev/",testnet:!0,contracts:{erc20Factory:"0xCAb3353b6055d6FDE858f8b862B90c9f81f63Ec3",erc721Factory:"0xCfBDe041302aA0Fdee0dbAd4E22cc937fdC184ED"}},P={id:37111,name:"Lens Local Network",network:"lens-local-network",rpcUrl:"http://localhost:4096",blockExplorerUrl:"https://explorer.staging.lens.zksync.dev/",testnet:!0,contracts:{erc20Factory:"0xCAb3353b6055d6FDE858f8b862B90c9f81f63Ec3",erc721Factory:"0xCfBDe041302aA0Fdee0dbAd4E22cc937fdC184ED"}};var a=class n extends NetworkPlugin{contracts;constructor(e){super(n.name),this.contracts=e;}clone(){return new n(this.contracts)}static name="xyz.lens.network.contracts"};function C(n){assert(n?.name===a.name,`Network plugin ${a.name} not found`,"UNKNOWN_ERROR");}function L(n){return ()=>{let e=new Network(n.name,n.id);return e.attachPlugin(new a(n.contracts)),e}}[s].forEach(n=>Network.register(n.id,L(n)));function E(n){return class extends n{getTokenBalance(t,r){return this.send("lens_getTokenBalance",[{address:t,contractAddress:r}])}getContractABI(t){return this.send("lens_getContractABI",[t])}getTokenTxHistory(t){return this.send("lens_getTokenTxHistory",[t])}getNftTxHistory(t){return this.send("lens_getNftTxHistory",[t])}getTokenInfo(t){return this.send("lens_getTokenInfo",[t])}async getContractCreation(t){return await this.send("lens_getContractCreation",t)??[]}async getTxHistory(t){return this.send("lens_getTxHistory",[t])}async getBlockNumberByTime(t,r){return this.send("lens_getBlockNumberByTime",[t,r])}async sendRawTransactionWithDetailedOutput(t){return this.send("zks_sendRawTransactionWithDetailedOutput",[t])}static getDefaultProvider(t){throw new Error("Use 'getDefaultProvider' from '@lens-network/sdk/ethers' instead")}}}var o=class extends E(c.Provider){getTokenBalance(e,t){return super.getTokenBalance(e,t)}getContractABI(e){return super.getContractABI(e)}getTokenTxHistory(e){return super.getTokenTxHistory(e)}getNftTxHistory(e){return super.getNftTxHistory(e)}getTokenInfo(e){return super.getTokenInfo(e)}getContractCreation(e){return super.getContractCreation(e)}getTxHistory(e){return super.getTxHistory(e)}getBlockNumberByTime(e,t){return super.getBlockNumberByTime(e,t)}sendRawTransactionWithDetailedOutput(e){return super.sendRawTransactionWithDetailedOutput(e)}},d=class extends E(c.BrowserProvider){getTokenBalance(e,t){return super.getTokenBalance(e,t)}getContractABI(e){return super.getContractABI(e)}getTokenTxHistory(e){return super.getTokenTxHistory(e)}getNftTxHistory(e){return super.getNftTxHistory(e)}getTokenInfo(e){return super.getTokenInfo(e)}getContractCreation(e){return super.getContractCreation(e)}getTxHistory(e){return super.getTxHistory(e)}getBlockNumberByTime(e,t){return super.getBlockNumberByTime(e,t)}sendRawTransactionWithDetailedOutput(e){return super.sendRawTransactionWithDetailedOutput(e)}};var m=(r=>(r[r.Mainnet=NaN]="Mainnet",r[r.Testnet=NaN]="Testnet",r[r.Staging=s.id]="Staging",r))(m||{});var g=class extends Error{name="InvariantError"};function v(n,e){throw new g(e)}function U(n){switch(n){case m.Staging:return new o(s.rpcUrl);case NaN:case NaN:v(!1,"Network supported yet");}}var N={};R(N,{localhost:()=>W,staging:()=>z});var H={name:"Ether",symbol:"ETH",decimals:18};function B(n){return {chainId:toBeHex(n.id),chainName:n.name,nativeCurrency:H,rpcUrls:[n.rpcUrl],blockExplorerUrls:[n.blockExplorerUrl]}}var z=B(s),W=B(P);var p={};R(p,{BasicErc20__factory:()=>u,Erc20Factory__factory:()=>l});var T=[{inputs:[{components:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"uint256",name:"initialSupply",type:"uint256"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"symbol",type:"string"}],internalType:"struct BasicErc20.TokenParams",name:"params",type:"tuple"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"revision",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],u=class{static abi=T;static createInterface(){return new Interface(T)}static connect(e,t){return new Contract(e,T,t)}};var f=[{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"tokenAddress",type:"address"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"string",name:"name",type:"string"},{indexed:!1,internalType:"string",name:"symbol",type:"string"},{indexed:!1,internalType:"uint256",name:"initialSupply",type:"uint256"}],name:"TokenCreated",type:"event"},{inputs:[{components:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"uint256",name:"initialSupply",type:"uint256"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"symbol",type:"string"}],internalType:"struct BasicErc20.TokenParams",name:"params",type:"tuple"}],name:"createToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getTokens",outputs:[{internalType:"contract BasicErc20[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"initialOwner",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"revision",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"tokens",outputs:[{internalType:"contract BasicErc20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],l=class{static abi=f;static createInterface(){return new Interface(f)}static connect(e,t){return new Contract(e,f,t)}};function A(n){return class extends n{async createErc20(t){let{chainId:r}=await this._providerL2().getNetwork(),i=Network.from(r)?.getPlugin(a.name);C(i);let k=await(await p.Erc20Factory__factory.connect(i.contracts.erc20Factory,this._signerL2()).createToken(t)).wait();assert(k!==null,"Transaction failed","NETWORK_ERROR");let b=k.logs.find(O=>O.address===i.contracts.erc20Factory);assert(b instanceof EventLog,"Event log not found","NETWORK_ERROR");let w=p.Erc20Factory__factory.createInterface().parseLog(b);return assert(w?.name==="TokenCreated","Token not created","NETWORK_ERROR"),w.args.tokenAddress}}}var D=class extends A(c.Wallet){createErc20(e){return super.createErc20(e)}connect(e){return super.connect(e)}},I=class n extends A(c.Signer){createErc20(e){return super.createErc20(e)}static from(e,t,r){let i=super.from(e,t,r);return Object.setPrototypeOf(i,n.prototype)}};
var W=Object.defineProperty;var I=(n,e)=>{for(var t in e)W(n,t,{get:e[t],enumerable:!0});};var a={id:37111,name:"Lens Development Network",network:"lens-development-network",rpcUrl:"https://rpc.staging.lens-network.crtlkey.com/",blockExplorerUrl:"https://explorer.staging.lens.zksync.dev/",testnet:!0,contracts:{erc20Factory:"0xCAb3353b6055d6FDE858f8b862B90c9f81f63Ec3",erc721Factory:"0xCfBDe041302aA0Fdee0dbAd4E22cc937fdC184ED"}},H={id:37111,name:"Lens Local Network",network:"lens-local-network",rpcUrl:"http://localhost:4096",blockExplorerUrl:"https://explorer.staging.lens.zksync.dev/",testnet:!0,contracts:{erc20Factory:"0xCAb3353b6055d6FDE858f8b862B90c9f81f63Ec3",erc721Factory:"0xCfBDe041302aA0Fdee0dbAd4E22cc937fdC184ED"}};var i=class n extends NetworkPlugin{contracts;constructor(e){super(n.name),this.contracts=e;}clone(){return new n(this.contracts)}static name="xyz.lens.network.contracts"};function k(n){assert(n?.name===i.name,`Network plugin ${i.name} not found`,"UNKNOWN_ERROR");}function V(n){return ()=>{let e=new Network(n.name,n.id);return e.attachPlugin(new i(n.contracts)),e}}[a].forEach(n=>Network.register(n.id,V(n)));function M(n){return class extends n{getTokenBalance(t,r){return this.send("lens_getTokenBalance",[{address:t,contractAddress:r}])}getContractABI(t){return this.send("lens_getContractABI",[t])}getTokenTxHistory(t){return this.send("lens_getTokenTxHistory",[t])}getNftTxHistory(t){return this.send("lens_getNftTxHistory",[t])}getTokenInfo(t){return this.send("lens_getTokenInfo",[t])}async getContractCreation(t){return await this.send("lens_getContractCreation",t)??[]}async getTxHistory(t){return this.send("lens_getTxHistory",[t])}async getBlockNumberByTime(t,r){return this.send("lens_getBlockNumberByTime",[t,r])}async sendRawTransactionWithDetailedOutput(t){return this.send("zks_sendRawTransactionWithDetailedOutput",[t])}static getDefaultProvider(t){throw new Error("Use 'getDefaultProvider' from '@lens-network/sdk/ethers' instead")}}}var d=class extends M(m.Provider){getTokenBalance(e,t){return super.getTokenBalance(e,t)}getContractABI(e){return super.getContractABI(e)}getTokenTxHistory(e){return super.getTokenTxHistory(e)}getNftTxHistory(e){return super.getNftTxHistory(e)}getTokenInfo(e){return super.getTokenInfo(e)}getContractCreation(e){return super.getContractCreation(e)}getTxHistory(e){return super.getTxHistory(e)}getBlockNumberByTime(e,t){return super.getBlockNumberByTime(e,t)}sendRawTransactionWithDetailedOutput(e){return super.sendRawTransactionWithDetailedOutput(e)}},E=class extends M(m.BrowserProvider){getTokenBalance(e,t){return super.getTokenBalance(e,t)}getContractABI(e){return super.getContractABI(e)}getTokenTxHistory(e){return super.getTokenTxHistory(e)}getNftTxHistory(e){return super.getNftTxHistory(e)}getTokenInfo(e){return super.getTokenInfo(e)}getContractCreation(e){return super.getContractCreation(e)}getTxHistory(e){return super.getTxHistory(e)}getBlockNumberByTime(e,t){return super.getBlockNumberByTime(e,t)}sendRawTransactionWithDetailedOutput(e){return super.sendRawTransactionWithDetailedOutput(e)}};var v=(r=>(r[r.Mainnet=NaN]="Mainnet",r[r.Testnet=NaN]="Testnet",r[r.Staging=a.id]="Staging",r))(v||{});var R=class extends Error{name="InvariantError"};function N(n,e){throw new R(e)}function $(n){switch(n){case v.Staging:return new d(a.rpcUrl);case NaN:case NaN:N(!1,"Network supported yet");}}var D={};I(D,{localhost:()=>X,staging:()=>Q});var A={name:"Ether",symbol:"ETH",decimals:18};function F(n){return {chainId:toBeHex(n.id),chainName:n.name,nativeCurrency:A,rpcUrls:[n.rpcUrl],blockExplorerUrls:[n.blockExplorerUrl]}}var Q=F(a),X=F(H);var l={};I(l,{BasicErc20__factory:()=>T,BasicErc721__factory:()=>g,Erc20Factory__factory:()=>f,Erc721Factory__factory:()=>x});var h=[{inputs:[{components:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"uint256",name:"initialSupply",type:"uint256"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"symbol",type:"string"}],internalType:"struct BasicErc20.TokenParams",name:"params",type:"tuple"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"revision",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],T=class{static abi=h;static createInterface(){return new Interface(h)}static connect(e,t){return new Contract(e,h,t)}};var P=[{inputs:[{components:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"uint256",name:"maxSupply",type:"uint256"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"symbol",type:"string"}],internalType:"struct BasicErc721.TokenParams",name:"params",type:"tuple"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"_fromTokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"_toTokenId",type:"uint256"}],name:"BatchMetadataUpdate",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"MetadataUpdate",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"revision",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],g=class{static abi=P;static createInterface(){return new Interface(P)}static connect(e,t){return new Contract(e,P,t)}};var C=[{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"tokenAddress",type:"address"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"string",name:"name",type:"string"},{indexed:!1,internalType:"string",name:"symbol",type:"string"},{indexed:!1,internalType:"uint256",name:"initialSupply",type:"uint256"}],name:"TokenCreated",type:"event"},{inputs:[{components:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"uint256",name:"initialSupply",type:"uint256"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"symbol",type:"string"}],internalType:"struct BasicErc20.TokenParams",name:"params",type:"tuple"}],name:"createToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getTokens",outputs:[{internalType:"contract BasicErc20[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"initialOwner",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"revision",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"tokens",outputs:[{internalType:"contract BasicErc20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],f=class{static abi=C;static createInterface(){return new Interface(C)}static connect(e,t){return new Contract(e,C,t)}};var B=[{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"tokenAddress",type:"address"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"string",name:"name",type:"string"},{indexed:!1,internalType:"string",name:"symbol",type:"string"},{indexed:!1,internalType:"uint256",name:"maxSupply",type:"uint256"}],name:"TokenCreated",type:"event"},{inputs:[{components:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"uint256",name:"maxSupply",type:"uint256"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"symbol",type:"string"}],internalType:"struct BasicErc721.TokenParams",name:"params",type:"tuple"}],name:"createToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getTokens",outputs:[{internalType:"contract BasicErc721[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"initialOwner",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"revision",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"tokens",outputs:[{internalType:"contract BasicErc721",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],x=class{static abi=B;static createInterface(){return new Interface(B)}static connect(e,t){return new Contract(e,B,t)}};function z(n){return class extends n{async createErc20(t){let{chainId:r}=await this._providerL2().getNetwork(),s=Network.from(r)?.getPlugin(i.name);k(s);let p=l.Erc20Factory__factory.connect(s.contracts.erc20Factory,this._signerL2()),u=await(await p.createToken(t)).wait();assert(u!==null,"Transaction failed","NETWORK_ERROR");let y=u.logs.find(w=>w.address===s.contracts.erc20Factory);assert(y instanceof EventLog,"Event log not found","NETWORK_ERROR");let c=p.interface.parseLog(y);return assert(c?.name==="TokenCreated","Token not created","NETWORK_ERROR"),c.args.tokenAddress}async createErc721(t){let{chainId:r}=await this._providerL2().getNetwork(),s=Network.from(r)?.getPlugin(i.name);k(s);let p=l.Erc721Factory__factory.connect(s.contracts.erc721Factory,this._signerL2()),u=await(await p.createToken(t)).wait();assert(u!==null,"Transaction failed","NETWORK_ERROR");let y=u.logs.find(w=>w.address===s.contracts.erc721Factory);assert(y instanceof EventLog,"Event log not found","NETWORK_ERROR");let c=p.interface.parseLog(y);return assert(c?.name==="TokenCreated","Token not created","NETWORK_ERROR"),c.args.tokenAddress}}}var L=class extends z(m.Wallet){createErc20(e){return super.createErc20(e)}createErc721(e){return super.createErc721(e)}connect(e){return super.connect(e)}},U=class n extends z(m.Signer){createErc20(e){return super.createErc20(e)}createErc721(e){return super.createErc721(e)}static from(e,t,r){let s=super.from(e,t,r);return Object.setPrototypeOf(s,n.prototype)}};
export { d as BrowserProvider, m as Network, o as Provider, I as Signer, D as Wallet, N as chains, U as getDefaultProvider };
export { E as BrowserProvider, v as Network, d as Provider, U as Signer, L as Wallet, D as chains, $ as getDefaultProvider };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.js.map
{
"name": "@lens-network/sdk",
"version": "0.0.0-canary-20240627133053",
"version": "0.0.0-canary-20240627144825",
"description": "The quickest way to connect your dApp to the Lens Network.",

@@ -115,4 +115,4 @@ "type": "module",

"test": "vitest --passWithNoTests",
"test:write": "TEST_TAGS=@write vitest -t \"\\[tag:\\s@write\\]\" --allowOnly"
"test:write": "TEST_TAGS=@write vitest -t \"\\[tag:\\s@write\\]\" --allowOnly --no-file-parallelism"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc