repo_name
string
dataset
string
owner
string
lang
string
func_name
string
code
string
docstring
string
url
string
sha
string
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getWithdrawalsByAddress
public async getWithdrawalsByAddress( address: AddressLike, opts: { fromBlock?: BlockTag toBlock?: BlockTag } = {} ): Promise<TokenBridgeMessage[]> { return ( await Promise.all( Object.values(this.bridges).map(async (bridge) => { return bridge.getWithdrawalsByAddres...
/** * Gets all withdrawals for a given address. * @param address Address to search for messages from. * @param opts Options object. * @param opts.fromBlock Block to start searching for messages from. If not provided, will start * from the first block (block #0). * @param opts.toBlock Block to stop sea...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L587-L608
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.toCrossChainMessage
public async toCrossChainMessage( message: MessageLike, messageIndex = 0 ): Promise<CrossChainMessage> { if (!message) { throw new Error('message is undefined') } // TODO: Convert these checks into proper type checks. if ((message as CrossChainMessage).message) { return message as ...
/** * Resolves a MessageLike into a CrossChainMessage object. * Unlike other coercion functions, this function is stateful and requires making additional * requests. For now I'm going to keep this function here, but we could consider putting a * similar function inside of utils/coercion.ts if people want to...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L620-L674
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getMessageStatus
public async getMessageStatus( message: MessageLike, // consider making this an options object next breaking release messageIndex = 0, /** * @deprecated no longer used since no log filters are used */ fromBlockOrBlockHash?: BlockTag, /** * @deprecated no longer used since no log f...
/** * Retrieves the status of a particular message as an enum. * @param message Cross chain message to check the status of. * @param messageIndex The index of the message, if multiple exist from multicall * @param fromBlockOrBlockHash The start block to use for the query filter on the RECEIVING chain * @...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L684-L847
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getMessageReceipt
public async getMessageReceipt( message: MessageLike, messageIndex = 0, fromBlockOrBlockHash?: BlockTag, toBlockOrHash?: BlockTag ): Promise<MessageReceipt> { const resolved = await this.toCrossChainMessage(message, messageIndex) // legacy withdrawals relayed prebedrock are v1 const messag...
/** * Finds the receipt of the transaction that executed a particular cross chain message. * @param message Message to find the receipt of. * @param messageIndex The index of the message, if multiple exist from multicall * @param fromBlockOrBlockHash The start block to use for the query filter on the RECEIV...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L858-L954
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.waitForMessageReceipt
public async waitForMessageReceipt( message: MessageLike, opts: { fromBlockOrBlockHash?: BlockTag toBlockOrHash?: BlockTag confirmations?: number pollIntervalMs?: number timeoutMs?: number } = {}, /** * The index of the withdrawal if multiple are made with multicall ...
/** * Waits for a message to be executed and returns the receipt of the transaction that executed * the given message. * @param message Message to wait for. * @param opts Options to pass to the waiting function. * @param opts.confirmations Number of transaction confirmations to wait for before returning....
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L970-L1006
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.waitForMessageStatus
public async waitForMessageStatus( message: MessageLike, status: MessageStatus, opts: { fromBlockOrBlockHash?: BlockTag toBlockOrBlockHash?: BlockTag pollIntervalMs?: number timeoutMs?: number } = {}, messageIndex = 0 ): Promise<void> { // Resolving once up-front is sli...
/** * Waits until the status of a given message changes to the expected status. Note that if the * status of the given message changes to a status that implies the expected status, this will * still return. If the status of the message changes to a status that exclues the expected * status, this will throw ...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1022-L1095
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.estimateL2MessageGasLimit
public async estimateL2MessageGasLimit( message: MessageRequestLike, opts?: { bufferPercent?: number from?: string }, messageIndex = 0 ): Promise<BigNumber> { let resolved: CrossChainMessage | CrossChainMessageRequest let from: string if ((message as CrossChainMessage).messageN...
/** * Estimates the amount of gas required to fully execute a given message on L2. Only applies to * L1 => L2 messages. You would supply this gas limit when sending the message to L2. * @param message Message get a gas estimate for. * @param opts Options object. * @param opts.bufferPercent Percentage of ...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1106-L1141
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.estimateMessageWaitTimeSeconds
public async estimateMessageWaitTimeSeconds( message: MessageLike, // consider making this an options object next breaking release messageIndex = 0, fromBlockOrBlockHash?: BlockTag, toBlockOrBlockHash?: BlockTag ): Promise<number> { const resolved = await this.toCrossChainMessage(message, mess...
/** * Returns the estimated amount of time before the message can be executed. When this is a * message being sent to L1, this will return the estimated time until the message will complete * its challenge period. When this is a message being sent to L2, this will return the estimated * amount of time until...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1154-L1220
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getChallengePeriodSeconds
public async getChallengePeriodSeconds(): Promise<number> { if (!this.bedrock) { return ( await this.contracts.l1.StateCommitmentChain.FRAUD_PROOF_WINDOW() ).toNumber() } const oracleVersion = await this.contracts.l1.L2OutputOracle.version() const challengePeriod = oracleVersi...
/** * Queries the current challenge period in seconds from the StateCommitmentChain. * @returns Current challenge period in seconds. */
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1226-L1246
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getProvenWithdrawal
public async getProvenWithdrawal( withdrawalHash: string ): Promise<ProvenWithdrawal | null> { if (!this.bedrock) { throw new Error('message proving only applies after the bedrock upgrade') } // Getting the withdrawal is easy before FPAC. if (!(await this.fpac())) { // Grab the proven...
/** * Queries the OptimismPortal contract's `provenWithdrawals` mapping * for a ProvenWithdrawal that matches the passed withdrawalHash * @bedrock * Note: This function is bedrock-specific. * @returns A ProvenWithdrawal object */
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1255-L1351
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.isValidOutputRoot
public async isValidOutputRoot( outputRoot: string, l2BlockNumber: number ): Promise<boolean> { // Use the cache if we can. const cached = this._outputCache.find((other) => { return other.root === outputRoot }) // Skip if we can use the cached. if (cached) { return cached.vali...
/** * Checks whether a given root claim is valid. Uses the L2 node that the SDK is connected to * when verifying the claim. Assumes that the connected L2 node is honest. * @param outputRoot Output root to verify. * @param l2BlockNumber L2 block number the root is for. * @returns Whether or not the root i...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1360-L1418
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getMessageBedrockOutput
public async getMessageBedrockOutput( message: MessageLike, messageIndex = 0 ): Promise<BedrockOutputData | null> { const resolved = await this.toCrossChainMessage(message, messageIndex) // Outputs are only a thing for L2 to L1 messages. if (resolved.direction === MessageDirection.L1_TO_L2) { ...
/** * Returns the Bedrock output root that corresponds to the given message. * @param message Message to get the Bedrock output root for. * @param messageIndex The index of the message, if multiple exist from multicall * @returns Bedrock output root. */
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1426-L1538
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getMessageStateRoot
public async getMessageStateRoot( message: MessageLike, messageIndex = 0 ): Promise<StateRoot | null> { const resolved = await this.toCrossChainMessage(message, messageIndex) // State roots are only a thing for L2 to L1 messages. if (resolved.direction === MessageDirection.L1_TO_L2) { throw...
/** * Returns the state root that corresponds to a given message. This is the state root for the * block in which the transaction was included, as published to the StateCommitmentChain. If the * state root for the given message has not been published yet, this function returns null. * @param message Message...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1548-L1598
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getStateBatchAppendedEventByBatchIndex
public async getStateBatchAppendedEventByBatchIndex( batchIndex: number ): Promise<ethers.Event | null> { const events = await this.contracts.l1.StateCommitmentChain.queryFilter( this.contracts.l1.StateCommitmentChain.filters.StateBatchAppended( batchIndex ) ) if (events.length ==...
/** * Returns the StateBatchAppended event that was emitted when the batch with a given index was * created. Returns null if no such event exists (the batch has not been submitted). * @param batchIndex Index of the batch to find an event for. * @returns StateBatchAppended event for the batch, or null if no ...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1606-L1623
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getStateBatchAppendedEventByTransactionIndex
public async getStateBatchAppendedEventByTransactionIndex( transactionIndex: number ): Promise<ethers.Event | null> { const isEventHi = (event: ethers.Event, index: number) => { const prevTotalElements = event.args._prevTotalElements.toNumber() return index < prevTotalElements } const isE...
/** * Returns the StateBatchAppended event for the batch that includes the transaction with the * given index. Returns null if no such event exists. * @param transactionIndex Index of the L2 transaction to find an event for. * @returns StateBatchAppended event for the batch that includes the given transacti...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1631-L1688
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getStateRootBatchByTransactionIndex
public async getStateRootBatchByTransactionIndex( transactionIndex: number ): Promise<StateRootBatch | null> { const stateBatchAppendedEvent = await this.getStateBatchAppendedEventByTransactionIndex(transactionIndex) if (stateBatchAppendedEvent === null) { return null } const stateBat...
/** * Returns information about the state root batch that included the state root for the given * transaction by index. Returns null if no such state root has been published yet. * @param transactionIndex Index of the L2 transaction to find a state root batch for. * @returns State root batch for the given t...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1696-L1723
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getMessageProof
public async getMessageProof( message: MessageLike, messageIndex = 0 ): Promise<CrossChainMessageProof> { const resolved = await this.toCrossChainMessage(message, messageIndex) if (resolved.direction === MessageDirection.L1_TO_L2) { throw new Error(`can only generate proofs for L2 to L1 messages...
/** * Generates the proof required to finalize an L2 to L1 message. * @param message Message to generate a proof for. * @param messageIndex The index of the message, if multiple exist from multicall * @returns Proof that can be used to finalize the message. */
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1731-L1782
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.getBedrockMessageProof
public async getBedrockMessageProof( message: MessageLike, messageIndex = 0 ): Promise<BedrockCrossChainMessageProof> { const resolved = await this.toCrossChainMessage(message, messageIndex) if (resolved.direction === MessageDirection.L1_TO_L2) { throw new Error(`can only generate proofs for L2 ...
/** * Generates the bedrock proof required to finalize an L2 to L1 message. * @param message Message to generate a proof for. * @param messageIndex The index of the message, if multiple exist from multicall * @returns Proof that can be used to finalize the message. */
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1790-L1832
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.sendMessage
public async sendMessage( message: CrossChainMessageRequest, opts?: { signer?: Signer l2GasLimit?: NumberLike overrides?: Overrides } ): Promise<TransactionResponse> { const tx = await this.populateTransaction.sendMessage(message, opts) if (message.direction === MessageDirection....
/** * Sends a given cross chain message. Where the message is sent depends on the direction attached * to the message itself. * @param message Cross chain message to send. * @param opts Additional options. * @param opts.signer Optional signer to use to send the transaction. * @param opts.l2GasLimit Op...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1844-L1858
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.resendMessage
public async resendMessage( message: MessageLike, messageGasLimit: NumberLike, opts?: { signer?: Signer overrides?: Overrides } ): Promise<TransactionResponse> { return (opts?.signer || this.l1Signer).sendTransaction( await this.populateTransaction.resendMessage( message,...
/** * Resends a given cross chain message with a different gas limit. Only applies to L1 to L2 * messages. If provided an L2 to L1 message, this function will throw an error. * @param message Cross chain message to resend. * @param messageGasLimit New gas limit to use for the message. * @param opts Addit...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1870-L1885
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.proveMessage
public async proveMessage( message: MessageLike, opts?: { signer?: Signer overrides?: Overrides }, /** * The index of the withdrawal if multiple are made with multicall */ messageIndex: number = 0 ): Promise<TransactionResponse> { const tx = await this.populateTransaction...
/** * Proves a cross chain message that was sent from L2 to L1. Only applicable for L2 to L1 * messages. * @param message Message to finalize. * @param opts Additional options. * @param opts.signer Optional signer to use to send the transaction. * @param opts.overrides Optional transaction overrides. ...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1896-L1913
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.finalizeMessage
public async finalizeMessage( message: MessageLike, opts?: { signer?: Signer overrides?: PayableOverrides }, messageIndex = 0 ): Promise<TransactionResponse> { return (opts?.signer || this.l1Signer).sendTransaction( await this.populateTransaction.finalizeMessage( message,...
/** * Finalizes a cross chain message that was sent from L2 to L1. Only applicable for L2 to L1 * messages. Will throw an error if the message has not completed its challenge period yet. * @param message Message to finalize. * @param opts Additional options. * @param opts.signer Optional signer to use to...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1925-L1940
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.depositETH
public async depositETH( amount: NumberLike, opts?: { recipient?: AddressLike signer?: Signer l2GasLimit?: NumberLike overrides?: Overrides } ): Promise<TransactionResponse> { return (opts?.signer || this.l1Signer).sendTransaction( await this.populateTransaction.depositET...
/** * Deposits some ETH into the L2 chain. * @param amount Amount of ETH to deposit (in wei). * @param opts Additional options. * @param opts.signer Optional signer to use to send the transaction. * @param opts.recipient Optional address to receive the funds on L2. Defaults to sender. * @param opts.l2...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1952-L1964
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.withdrawETH
public async withdrawETH( amount: NumberLike, opts?: { recipient?: AddressLike signer?: Signer overrides?: Overrides } ): Promise<TransactionResponse> { return (opts?.signer || this.l2Signer).sendTransaction( await this.populateTransaction.withdrawETH(amount, opts) ) }
/** * Withdraws some ETH back to the L1 chain. * @param amount Amount of ETH to withdraw. * @param opts Additional options. * @param opts.signer Optional signer to use to send the transaction. * @param opts.recipient Optional address to receive the funds on L1. Defaults to sender. * @param opts.overri...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1975-L1986
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.approval
public async approval( l1Token: AddressLike, l2Token: AddressLike, opts?: { signer?: Signer } ): Promise<BigNumber> { const bridge = await this.getBridgeForTokenPair(l1Token, l2Token) return bridge.approval(l1Token, l2Token, opts?.signer || this.l1Signer) }
/** * Queries the account's approval amount for a given L1 token. * @param l1Token The L1 token address. * @param l2Token The L2 token address. * @param opts Additional options. * @param opts.signer Optional signer to get the approval for. * @returns Amount of tokens approved for deposits from the acc...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L1996-L2005
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.approveERC20
public async approveERC20( l1Token: AddressLike, l2Token: AddressLike, amount: NumberLike, opts?: { signer?: Signer overrides?: Overrides } ): Promise<TransactionResponse> { return (opts?.signer || this.l1Signer).sendTransaction( await this.populateTransaction.approveERC20( ...
/** * Approves a deposit into the L2 chain. * @param l1Token The L1 token address. * @param l2Token The L2 token address. * @param amount Amount of the token to approve. * @param opts Additional options. * @param opts.signer Optional signer to use to send the transaction. * @param opts.overrides Op...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L2017-L2034
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.depositERC20
public async depositERC20( l1Token: AddressLike, l2Token: AddressLike, amount: NumberLike, opts?: { recipient?: AddressLike signer?: Signer l2GasLimit?: NumberLike overrides?: CallOverrides } ): Promise<TransactionResponse> { return (opts?.signer || this.l1Signer).sendT...
/** * Deposits some ERC20 tokens into the L2 chain. * @param l1Token Address of the L1 token. * @param l2Token Address of the L2 token. * @param amount Amount to deposit. * @param opts Additional options. * @param opts.signer Optional signer to use to send the transaction. * @param opts.recipient O...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L2048-L2067
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
CrossChainMessenger.withdrawERC20
public async withdrawERC20( l1Token: AddressLike, l2Token: AddressLike, amount: NumberLike, opts?: { recipient?: AddressLike signer?: Signer overrides?: Overrides } ): Promise<TransactionResponse> { return (opts?.signer || this.l2Signer).sendTransaction( await this.popu...
/** * Withdraws some ERC20 tokens back to the L1 chain. * @param l1Token Address of the L1 token. * @param l2Token Address of the L2 token. * @param amount Amount to withdraw. * @param opts Additional options. * @param opts.signer Optional signer to use to send the transaction. * @param opts.recipi...
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L2080-L2098
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
getOpts
const getOpts = async () => { if (isEstimatingGas) { return opts } // if we don't include the users address the estimation will fail from lack of allowance if (!ethers.Signer.isSigner(this.l1SignerOrProvider)) { throw new Error('unable to deposit without an l1 signer'...
// we need extra buffer for gas limit
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/cross-chain-messenger.ts#L2460-L2489
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
getNonceForTx
const getNonceForTx = async ( provider: ProviderLike, tx: TransactionRequest ): Promise<number> => { if (tx.nonce !== undefined) { return toNumber(tx.nonce as NumberLike) } else if (tx.from !== undefined) { return toProvider(provider).getTransactionCount(tx.from) } else { // Large nonce with lots ...
/** * Gets a reasonable nonce for the transaction. * @param provider Provider to get the nonce from. * @param tx Requested transaction. * @returns A reasonable nonce for the transaction. */
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/l2-provider.ts#L19-L31
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
connectGasPriceOracle
const connectGasPriceOracle = (provider: ProviderLike): Contract => { return new Contract( predeploys.OVM_GasPriceOracle, getContractInterface('OVM_GasPriceOracle'), toProvider(provider) ) }
/** * Returns a Contract object for the GasPriceOracle. * @param provider Provider to attach the contract to. * @returns Contract object for the GasPriceOracle. */
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/l2-provider.ts#L38-L44
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
StandardBridgeAdapter.constructor
constructor(opts: { messenger: CrossChainMessenger l1Bridge: AddressLike l2Bridge: AddressLike }) { this.messenger = opts.messenger this.l1Bridge = new Contract( toAddress(opts.l1Bridge), l1StandardBridgeArtifact.abi, this.messenger.l1Provider ) this.l2Bridge = new Contra...
/** * Creates a StandardBridgeAdapter instance. * @param opts Options for the adapter. * @param opts.messenger Provider used to make queries related to cross-chain interactions. * @param opts.l1Bridge L1 bridge contract. * @param opts.l2Bridge L2 bridge contract. */
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/adapters/standard-bridge.ts#L46-L62
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
getL1ContractsByNetworkName
const getL1ContractsByNetworkName = (network: string): OEL1ContractsLike => { return { AddressManager: addressManagerAddresses[network], L1CrossDomainMessenger: l1CrossDomainMessengerAddresses[network], L1StandardBridge: l1StandardBridgeAddresses[network], StateCommitmentChain: stateCommitmentChainAdd...
/** * Loads the L1 contracts for a given network by the network name. * @param network The name of the network to load the contracts for. * @returns The L1 contracts for the given network. */
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/sdk/src/utils/chain-constants.ts#L121-L134
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
camelCase
function camelCase(str: string): string { const [start, ...rest] = str return start.toLowerCase() + rest.join('') }
/** Utility Functions */
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/viem/scripts/abigen.ts#L18-L21
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
main
async function main() { console.log('Generating forge artifacts...') const contractsBedrockPath = path.join( OPTIMISM_PATH, 'packages', 'contracts-bedrock', ) try { execSync('forge build', { cwd: contractsBedrockPath, stdio: 'inherit' }) } catch (error) { throw new Error(`Failed to generat...
/** Abi Generation */
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/viem/scripts/abigen.ts#L25-L63
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
camelCase
function camelCase(str: string): string { const parts = str.replace(/-/g, ' ').replace(/_/g, ' ').split(' ') return ( parts[0].toLowerCase() + parts .slice(1) .map((part) => part[0].toUpperCase() + part.substring(1)) .join('') ) }
/** Utility functions **/
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/viem/scripts/chaingen.ts#L33-L42
c3d635fcb59f21f38710c4235fc741f57d16dad5
ecosystem
github_2023
ethereum-optimism
typescript
main
async function main() { console.log('Running chain generation...') const eta = new Eta({ views: './scripts/templates', debug: true, autoTrim: [false, false], }) const mainnetHttp = process.env.MAINNET_RPC_URL ? [process.env.MAINNET_RPC_URL] : mainnet.rpcUrls.default.http const mainnetClie...
/** Chain Generation **/
https://github.com/ethereum-optimism/ecosystem/blob/c3d635fcb59f21f38710c4235fc741f57d16dad5/packages/viem/scripts/chaingen.ts#L63-L161
c3d635fcb59f21f38710c4235fc741f57d16dad5
forgoodfirstissue
github_2023
github
typescript
getRepositories
const getRepositories = async ( repositories: string[], labels: string[] ): Promise<RepositoryModel[]> => { const searchQuery = [ ...repositories.map((repo) => `repo:${repo}`), "archived:false", "is:public", `pushed:>=${dayjs().add(-1, "month").format("YYYY-MM-DD")}` ].join(" "); const gqlQue...
/** * Retrieve a list of repositories by calling GitHub GraphQL API. */
https://github.com/github/forgoodfirstissue/blob/9f714a9d4ca49f462cc7727069eceaf6b2266413/generate.ts#L135-L406
9f714a9d4ca49f462cc7727069eceaf6b2266413
MaxKB
github_2023
1Panel-dev
typescript
getAPIKey
const getAPIKey: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( application_id, loading ) => { return get(`${prefix}/${application_id}/api_key`, undefined, loading) }
/** * API_KEY列表 * @param 参数 application_id */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application-overview.ts#L12-L17
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postAPIKey
const postAPIKey: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( application_id, loading ) => { return post(`${prefix}/${application_id}/api_key`, {}, undefined, loading) }
/** * 新增API_KEY * @param 参数 application_id */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application-overview.ts#L23-L28
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
delAPIKey
const delAPIKey: ( application_id: String, api_key_id: String, loading?: Ref<boolean> ) => Promise<Result<boolean>> = (application_id, api_key_id, loading) => { return del(`${prefix}/${application_id}/api_key/${api_key_id}`, undefined, undefined, loading) }
/** * 删除API_KEY * @param 参数 application_id api_key_id */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application-overview.ts#L34-L40
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putAPIKey
const putAPIKey: ( application_id: string, api_key_id: String, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, api_key_id, data, loading) => { return put(`${prefix}/${application_id}/api_key/${api_key_id}`, data, undefined, loading) }
/** * 修改API_KEY * @param 参数 application_id,api_key_id * data { * is_active: boolean * } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application-overview.ts#L49-L56
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getStatistics
const getStatistics: ( application_id: string, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, data, loading) => { return get(`${prefix}/${application_id}/statistics/chat_record_aggregate_trend`, data, loading) }
/** * 统计 * @param 参数 application_id, data */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application-overview.ts#L62-L68
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putAppIcon
const putAppIcon: ( application_id: string, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, data, loading) => { return put(`${prefix}/${application_id}/edit_icon`, data, undefined, loading) }
/** * 修改应用icon * @param 参数 application_id * data: file */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application-overview.ts#L75-L81
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getAccessToken
const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( application_id, loading ) => { return get(`${prefix}/${application_id}/setting`, undefined, loading) }
/** * 替换社区版-获取AccessToken * @param 参数 application_id */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application-xpack.ts#L11-L16
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putAccessToken
const putAccessToken: ( application_id: string, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, data, loading) => { return put(`${prefix}/${application_id}/setting`, data, undefined, loading) }
/** * 替换社区版-修改AccessToken * @param 参数 application_id * data { * "show_source": boolean, * "show_history": boolean, * "draggable": boolean, * "show_guide": boolean, * "avatar": file, * "float_icon": file, * } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application-xpack.ts#L30-L36
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getAllAppilcation
const getAllAppilcation: () => Promise<Result<any[]>> = () => { return get(`${prefix}`) }
/** * 获取全部应用 * @param 参数 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L14-L16
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getApplication
const getApplication: ( page: pageRequest, param: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (page, param, loading) => { return get(`${prefix}/${page.current_page}/${page.page_size}`, param, loading) }
/** * 获取分页应用 * page { "current_page": "string", "page_size": "string", } * param { "name": "string", } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L28-L34
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postApplication
const postApplication: ( data: ApplicationFormType, loading?: Ref<boolean> ) => Promise<Result<any>> = (data, loading) => { return post(`${prefix}`, data, undefined, loading) }
/** * 创建应用 * @param 参数 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L40-L45
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putApplication
const putApplication: ( application_id: String, data: ApplicationFormType, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, data, loading) => { return put(`${prefix}/${application_id}`, data, undefined, loading) }
/** * 修改应用 * @param 参数 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L51-L57
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
delApplication
const delApplication: ( application_id: String, loading?: Ref<boolean> ) => Promise<Result<boolean>> = (application_id, loading) => { return del(`${prefix}/${application_id}`, undefined, {}, loading) }
/** * 删除应用 * @param 参数 application_id */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L63-L68
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getApplicationDetail
const getApplicationDetail: ( application_id: string, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, loading) => { return get(`${prefix}/${application_id}`, undefined, loading) }
/** * 应用详情 * @param 参数 application_id */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L74-L79
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getApplicationDataset
const getApplicationDataset: ( application_id: string, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, loading) => { return get(`${prefix}/${application_id}/list_dataset`, undefined, loading) }
/** * 获得当前应用可使用的知识库 * @param 参数 application_id */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L85-L90
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getAccessToken
const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( application_id, loading ) => { return get(`${prefix}/${application_id}/access_token`, undefined, loading) }
/** * 获取AccessToken * @param 参数 application_id */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L96-L101
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putAccessToken
const putAccessToken: ( application_id: string, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, data, loading) => { return put(`${prefix}/${application_id}/access_token`, data, undefined, loading) }
/** * 修改AccessToken * @param 参数 application_id * data { * "is_active": true * } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L110-L116
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postAppAuthentication
const postAppAuthentication: ( access_token: string, loading?: Ref<boolean>, authentication_value?: any ) => Promise<any> = (access_token, loading, authentication_value) => { return post( `${prefix}/authentication`, { access_token: access_token, authentication_value }, undefined, loading ) }
/** * 应用认证 * @param 参数 { "access_token": "string" } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L125-L136
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getAppProfile
const getAppProfile: (loading?: Ref<boolean>) => Promise<any> = (loading) => { return get(`${prefix}/profile`, undefined, loading) }
/** * 对话获取应用相关信息 * @param 参数 { "access_token": "string" } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L145-L147
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postChatOpen
const postChatOpen: (data: ApplicationFormType) => Promise<Result<any>> = (data) => { return post(`${prefix}/chat/open`, data) }
/** * 获得临时回话Id * @param 参数 } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L155-L157
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postWorkflowChatOpen
const postWorkflowChatOpen: (data: ApplicationFormType) => Promise<Result<any>> = (data) => { return post(`${prefix}/chat_workflow/open`, data) }
/** * 获得工作流临时回话Id * @param 参数 } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L165-L167
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getChatOpen
const getChatOpen: (application_id: String) => Promise<Result<any>> = (application_id) => { return get(`${prefix}/${application_id}/chat/open`) }
/** * 正式回话Id * @param 参数 * { "model_id": "string", "multiple_rounds_dialogue": true, "dataset_id_list": [ "string" ] } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L180-L182
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postChatMessage
const postChatMessage: (chat_id: string, data: any) => Promise<any> = (chat_id, data) => { return postStream(`/api${prefix}/chat_message/${chat_id}`, data) }
/** * 对话 * @param 参数 * chat_id: string * data */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L189-L191
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putChatVote
const putChatVote: ( application_id: string, chat_id: string, chat_record_id: string, vote_status: string, loading?: Ref<boolean> ) => Promise<any> = (application_id, chat_id, chat_record_id, vote_status, loading) => { return put( `${prefix}/${application_id}/chat/${chat_id}/chat_record/${chat_record_id...
/** * 点赞、点踩 * @param 参数 * application_id : string; chat_id : string; chat_record_id : string * { "vote_status": "string", // -1 0 1 } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L201-L216
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getApplicationHitTest
const getApplicationHitTest: ( application_id: string, data: any, loading?: Ref<boolean> ) => Promise<Result<Array<any>>> = (application_id, data, loading) => { return get(`${prefix}/${application_id}/hit_test`, data, loading) }
/** * 命中测试列表 * @param application_id * @param loading * @query { query_text: string, top_number: number, similarity: number } * @returns */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L225-L231
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getApplicationModel
const getApplicationModel: ( application_id: string, loading?: Ref<boolean> ) => Promise<Result<Array<any>>> = (application_id, loading) => { return get(`${prefix}/${application_id}/model`, loading) }
/** * 获取当前用户可使用的模型列表 * @param application_id * @param loading * @query { query_text: string, top_number: number, similarity: number } * @returns */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L240-L245
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getApplicationRerankerModel
const getApplicationRerankerModel: ( application_id: string, loading?: Ref<boolean> ) => Promise<Result<Array<any>>> = (application_id, loading) => { return get(`${prefix}/${application_id}/model`, { model_type: 'RERANKER' }, loading) }
/** * 获取当前用户可使用的模型列表 * @param application_id * @param loading * @query { query_text: string, top_number: number, similarity: number } * @returns */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L254-L259
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getApplicationSTTModel
const getApplicationSTTModel: ( application_id: string, loading?: Ref<boolean> ) => Promise<Result<Array<any>>> = (application_id, loading) => { return get(`${prefix}/${application_id}/model`, { model_type: 'STT' }, loading) }
/** * 获取当前用户可使用的模型列表 * @param application_id * @param loading * @query { query_text: string, top_number: number, similarity: number } * @returns */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L268-L273
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getApplicationTTSModel
const getApplicationTTSModel: ( application_id: string, loading?: Ref<boolean> ) => Promise<Result<Array<any>>> = (application_id, loading) => { return get(`${prefix}/${application_id}/model`, { model_type: 'TTS' }, loading) }
/** * 获取当前用户可使用的模型列表 * @param application_id * @param loading * @query { query_text: string, top_number: number, similarity: number } * @returns */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L282-L287
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putPublishApplication
const putPublishApplication: ( application_id: String, data: ApplicationFormType, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, data, loading) => { return put(`${prefix}/${application_id}/publish`, data, undefined, loading) }
/** * 发布应用 * @param 参数 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L307-L313
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
listFunctionLib
const listFunctionLib: (application_id: String, loading?: Ref<boolean>) => Promise<Result<any>> = ( application_id, loading ) => { return get(`${prefix}/${application_id}/function_lib`, undefined, loading) }
/** * 获取应用所属的函数库列表 * @param application_id 应用id * @param loading * @returns */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L320-L325
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getFunctionLib
const getFunctionLib: ( application_id: String, function_lib_id: String, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, function_lib_id, loading) => { return get(`${prefix}/${application_id}/function_lib/${function_lib_id}`, undefined, loading) }
/** * 获取应用所属的函数库 * @param application_id * @param function_lib_id * @param loading * @returns */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L345-L351
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getModelParamsForm
const getModelParamsForm: ( application_id: String, model_id: String, loading?: Ref<boolean> ) => Promise<Result<Array<FormField>>> = (application_id, model_id, loading) => { return get(`${prefix}/${application_id}/model_params_form/${model_id}`, undefined, loading) }
/** * 获取模型参数表单 * @param application_id 应用id * @param model_id 模型id * @param loading * @returns */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L367-L373
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
uploadFile
const uploadFile: ( application_id: String, chat_id: String, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, chat_id, data, loading) => { return post(`${prefix}/${application_id}/chat/${chat_id}/upload_file`, data, undefined, loading) }
/** * 上传文档图片附件 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L378-L385
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postSpeechToText
const postSpeechToText: ( application_id: String, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, data, loading) => { return post(`${prefix}/${application_id}/speech_to_text`, data, undefined, loading) }
/** * 语音转文本 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L390-L396
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postTextToSpeech
const postTextToSpeech: ( application_id: String, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, data, loading) => { return download(`${prefix}/${application_id}/text_to_speech`, 'post', data, undefined, loading) }
/** * 文本转语音 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L401-L407
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
playDemoText
const playDemoText: ( application_id: String, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, data, loading) => { return download(`${prefix}/${application_id}/play_demo_text`, 'post', data, undefined, loading) }
/** * 播放测试文本 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L412-L418
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getPlatformStatus
const getPlatformStatus: (application_id: string) => Promise<Result<any>> = (application_id) => { return get(`/platform/${application_id}/status`) }
/** * 获取平台状态 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L422-L424
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getPlatformConfig
const getPlatformConfig: (application_id: string, type: string) => Promise<Result<any>> = ( application_id, type ) => { return get(`/platform/${application_id}/${type}`) }
/** * 获取平台配置 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L428-L433
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
updatePlatformConfig
const updatePlatformConfig: ( application_id: string, type: string, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, type, data, loading) => { return post(`/platform/${application_id}/${type}`, data, undefined, loading) }
/** * 更新平台配置 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L437-L444
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
updatePlatformStatus
const updatePlatformStatus: (application_id: string, data: any) => Promise<Result<any>> = ( application_id, data ) => { return post(`/platform/${application_id}/status`, data) }
/** * 更新平台状态 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L448-L453
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
validatePassword
const validatePassword: ( application_id: string, password: string, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, password, loading) => { return get(`/application/${application_id}/auth/${password}`, undefined, loading) }
/** * 验证密码 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L457-L463
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getWorkFlowVersion
const getWorkFlowVersion: ( application_id: string, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, loading) => { return get(`/application/${application_id}/work_flow_version`, undefined, loading) }
/** * workflow历史版本 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L468-L473
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getWorkFlowVersionDetail
const getWorkFlowVersionDetail: ( application_id: string, application_version_id: string, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, application_version_id, loading) => { return get( `/application/${application_id}/work_flow_version/${application_version_id}`, undefined, loa...
/** * workflow历史版本详情 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L478-L488
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putWorkFlowVersion
const putWorkFlowVersion: ( application_id: string, application_version_id: string, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (application_id, application_version_id, data, loading) => { return put( `/application/${application_id}/work_flow_version/${application_version_id}`, data,...
/** * 修改workflow历史版本 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L492-L504
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
importApplication
const importApplication: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( data, loading ) => { return post(`${prefix}/import`, data, undefined, loading) }
/** * 导入应用 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/application.ts#L529-L534
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getAuthSetting
const getAuthSetting: (auth_type: string, loading?: Ref<boolean>) => Promise<Result<any>> = (auth_type, loading) => { return get(`${prefix}/${auth_type}/detail`, undefined, loading) }
/** * 获取认证设置 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/auth-setting.ts#L10-L12
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postAuthSetting
const postAuthSetting: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( data, loading ) => { return post(`${prefix}/connection`, data, undefined, loading) }
/** * 邮箱测试 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/auth-setting.ts#L17-L22
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putAuthSetting
const putAuthSetting: (auth_type: string, data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( auth_type, data, loading ) => { return put(`${prefix}/${auth_type}/info`, data, undefined, loading) }
/** * 修改邮箱设置 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/auth-setting.ts#L27-L33
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getDataset
const getDataset: ( page: pageRequest, param: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (page, param, loading) => { return get(`${prefix}/${page.current_page}/${page.page_size}`, param, loading) }
/** * 获取分页知识库 * @param 参数 * page { "current_page": "string", "page_size": "string", } * param { "name": "string", } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L20-L26
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getAllDataset
const getAllDataset: (loading?: Ref<boolean>) => Promise<Result<any[]>> = (loading) => { return get(`${prefix}`, undefined, loading) }
/** * 获取全部知识库 * @param 参数 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L32-L34
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
delDataset
const delDataset: (dataset_id: String, loading?: Ref<boolean>) => Promise<Result<boolean>> = ( dataset_id, loading ) => { return del(`${prefix}/${dataset_id}`, undefined, {}, loading) }
/** * 删除知识库 * @param 参数 dataset_id */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L40-L45
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postDataset
const postDataset: (data: datasetData, loading?: Ref<boolean>) => Promise<Result<any>> = ( data, loading ) => { return post(`${prefix}`, data, undefined, loading, 1000 * 60 * 5) }
/** * 创建知识库 * @param 参数 * { "name": "string", "desc": "string", "documents": [ { "name": "string", "paragraphs": [ { "content": "string", "title": "string", "problem_list": [ { "id": "string", "content": "string" ...
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L72-L77
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postWebDataset
const postWebDataset: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( data, loading ) => { return post(`${prefix}/web`, data, undefined, loading) }
/** * 创建Web知识库 * @param 参数 * { "name": "string", "desc": "string", "source_url": "string", "selector": "string", } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L89-L94
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
postQADataset
const postQADataset: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( data, loading ) => { return post(`${prefix}/qa`, data, undefined, loading) }
/** * 创建QA知识库 * @param 参数 formData * { "file": "file", "name": "string", "desc": "string", } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L105-L110
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getDatasetDetail
const getDatasetDetail: (dataset_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( dataset_id, loading ) => { return get(`${prefix}/${dataset_id}`, undefined, loading) }
/** * 知识库详情 * @param 参数 dataset_id */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L116-L121
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putDataset
const putDataset: ( dataset_id: string, data: any, loading?: Ref<boolean> ) => Promise<Result<any>> = (dataset_id, data, loading) => { return put(`${prefix}/${dataset_id}`, data, undefined, loading) }
/** * 修改知识库信息 * @param 参数 * dataset_id * { "name": "string", "desc": true } */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L132-L138
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
listUsableApplication
const listUsableApplication: ( dataset_id: string, loading?: Ref<boolean> ) => Promise<Result<Array<ApplicationFormType>>> = (dataset_id, loading) => { return get(`${prefix}/${dataset_id}/application`, {}, loading) }
/** * 获取知识库 可关联的应用列表 * @param dataset_id * @param loading * @returns */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L145-L150
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
getDatasetHitTest
const getDatasetHitTest: ( dataset_id: string, data: any, loading?: Ref<boolean> ) => Promise<Result<Array<any>>> = (dataset_id, data, loading) => { return get(`${prefix}/${dataset_id}/hit_test`, data, loading) }
/** * 命中测试列表 * @param dataset_id * @param loading * @query { query_text: string, top_number: number, similarity: number } * @returns */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L159-L165
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putSyncWebDataset
const putSyncWebDataset: ( dataset_id: string, sync_type: string, loading?: Ref<boolean> ) => Promise<Result<any>> = (dataset_id, sync_type, loading) => { return put(`${prefix}/${dataset_id}/sync_web`, undefined, { sync_type }, loading) }
/** * 同步知识库 * @param 参数 dataset_id * @query 参数 sync_type // 同步类型->replace:替换同步,complete:完整同步 */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L172-L178
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
putReEmbeddingDataset
const putReEmbeddingDataset: ( dataset_id: string, loading?: Ref<boolean> ) => Promise<Result<any>> = (dataset_id, loading) => { return put(`${prefix}/${dataset_id}/re_embedding`, undefined, undefined, loading) }
/** * 向量化知识库 * @param 参数 dataset_id */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L184-L189
a1fca58864ba09b49e87bff186d4d428aaa45b72
MaxKB
github_2023
1Panel-dev
typescript
exportDataset
const exportDataset: ( dataset_name: string, dataset_id: string, loading?: Ref<boolean> ) => Promise<any> = (dataset_name, dataset_id, loading) => { return exportExcel(dataset_name + '.xlsx', `dataset/${dataset_id}/export`, undefined, loading) }
/** * 导出知识库 * @param dataset_name 知识库名称 * @param dataset_id 知识库id * @returns */
https://github.com/1Panel-dev/MaxKB/blob/a1fca58864ba09b49e87bff186d4d428aaa45b72/ui/src/api/dataset.ts#L197-L203
a1fca58864ba09b49e87bff186d4d428aaa45b72