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

@white-matrix/amethyst-sdk

Package Overview
Dependencies
Maintainers
12
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@white-matrix/amethyst-sdk

```javascript export interface AmethystDAOClient { connectProvider(address: string, provider: Provider): Promise;

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
12
Weekly downloads
 
Created
Source

@white-matrix/amethyst-sdk

export interface AmethystDAOClient {
    connectProvider(address: string, provider: Provider): Promise<AmethystDAOClient>;

    connectSigner(signer: Signer): AmethystDAOClient;

    setWaitConfirmations(num: number): void;

    /* ================ VIEWS ================ */

    /**
     * 获取所有account地址
     *
     * @param {CallOverrides} [config]
     * @return {Promise<Array<string>>} // 所有account地址数组
     * @memberof AmethystDAOClient
     */
    accounts(config?: CallOverrides): Promise<Array<string>>;

    /**
     * 获取account的Share权重
     *
     * @param {string} account // 需要查询的account地址
     * @param {CallOverrides} [config]
     * @return {Promise<BigNumber>} // account的Share权重
     * @memberof AmethystDAOClient
     */
    accountShare(account: string, config?: CallOverrides): Promise<BigNumber>;

    /**
     * 获取proposalId
     *
     * @param {Array<string>} targets // proposal执行call的目标地址的数组
     * @param {Array<BigNumber>} values // proposal向目标地址转账的eth数量的数组
     * @param {BytesLike[]} calldatas // proposal执行calldata的数组
     * @param {BytesLike} descriptionHash // description的hash值
     * @param {CallOverrides} [config]
     * @return {Promise<BigNumber>} // proposal的hash值
     * @memberof AmethystDAOClient
     */
    hashProposal(
        targets: Array<string>,
        values: Array<BigNumber>,
        calldatas: BytesLike[],
        descriptionHash: BytesLike,
        config?: CallOverrides
    ): Promise<BigNumber>;

    /**
     * 获取proposal状态
     *
     * @param {BigNumber} proposalId // proposal的hash值
     * @param {CallOverrides} [config]
     * @return {Promise<number>} // proposal的状态值
     * @memberof AmethystDAOClient
     */
    state(proposalId: BigNumber, config?: CallOverrides): Promise<number>;

    /**
     * 获取proposal开始时间
     *
     * @param {BigNumber} proposalId // proposal的hash值
     * @param {CallOverrides} [config]
     * @return {Promise<BigNumber>} // proposal的开始时间
     * @memberof AmethystDAOClient
     */
    proposalSnapshot(proposalId: BigNumber, config?: CallOverrides): Promise<BigNumber>;

    /**
     * 获取proposal截止时间
     *
     * @param {BigNumber} proposalId // proposal的hash值
     * @param {CallOverrides} [config]
     * @return {Promise<BigNumber>} // proposal的截止时间
     * @memberof AmethystDAOClient
     */
    proposalDeadline(proposalId: BigNumber, config?: CallOverrides): Promise<BigNumber>;

    /**
     * 投票延时
     *
     * @param {CallOverrides} [config]
     * @return {Promise<BigNumber>} // 从发起提案到投票开始的时间
     * @memberof AmethystDAOClient
     */
    votingDelay(config?: CallOverrides): Promise<BigNumber>;

    /**
     * 投票时间
     *
     * @param {CallOverrides} [config]
     * @return {Promise<BigNumber>} // 从投票开始到投票结束的时间
     * @memberof AmethystDAOClient
     */
    votingPeriod(config?: CallOverrides): Promise<BigNumber>;

    /**
     * proposal可执行的最少投票数
     *
     * @param {CallOverrides} [config]
     * @return {Promise<BigNumber>} // proposal可执行的最少投票数(支持+弃权)
     * @memberof AmethystDAOClient
     */
    quorum(config?: CallOverrides): Promise<BigNumber>;

    /**
     * 获取account票数
     *
     * @param {string} account // account地址
     * @param {CallOverrides} [config]
     * @return {Promise<BigNumber>} // account票数
     * @memberof AmethystDAOClient
     */
    getVotes(account: string, config?: CallOverrides): Promise<BigNumber>;

    /**
     * 查询account是否已经向proposal投票
     *
     * @param {BigNumber} proposalId // proposal的hash值
     * @param {string} account // account地址
     * @param {CallOverrides} [config]
     * @return {Promise<boolean>} // 是否已经投票
     * @memberof AmethystDAOClient
     */
    hasVoted(proposalId: BigNumber, account: string, config?: CallOverrides): Promise<boolean>;

    /* ================ TRANSACTIONS ================ */

    /**
     * 提出proposal
     *
     * @param {Array<string>} targets // proposal执行call的目标地址的数组
     * @param {Array<BigNumber>} values // proposal向目标地址转账的eth数量的数组
     * @param {BytesLike[]} calldatas // proposal执行calldata的数组
     * @param {string} description // proposal说明
     * @param {PayableOverrides} [config]
     * @return {Promise<TransactionEvent>} // 交易事件
     * @memberof AmethystDAOClient
     */
    propose(
        targets: Array<string>,
        values: Array<BigNumber>,
        calldatas: BytesLike[],
        description: string,
        executeTimeLock: BigNumber,
        config?: PayableOverrides
    ): Promise<TransactionEvent>;

    /**
     * 执行proposal
     *
     * @param {Array<string>} targets // proposal执行call的目标地址的数组
     * @param {Array<BigNumber>} values // proposal向目标地址转账的eth数量的数组
     * @param {BytesLike[]} calldatas// proposal执行calldata的数组
     * @param {BytesLike} descriptionHash // description的hash值
     * @param {PayableOverrides} [config]
     * @return {Promise<TransactionEvent>} // 交易事件
     * @memberof AmethystDAOClient
     */
    execute(
        targets: Array<string>,
        values: Array<BigNumber>,
        calldatas: BytesLike[],
        descriptionHash: BytesLike,
        config?: PayableOverrides
    ): Promise<TransactionEvent>;

    /**
     * 向proposal投票并写原因
     *
     * @param {BigNumber} proposalId // proposal的hash值
     * @param {number} support // 支持类型
     * @param {string} reason // 原因
     * @param {PayableOverrides} [config]
     * @return {Promise<TransactionEvent>} // 交易事件
     * @memberof AmethystDAOClient
     */
    castVoteWithReason(
        proposalId: BigNumber,
        support: number,
        reason: string,
        config?: PayableOverrides
    ): Promise<TransactionEvent>;
}

export interface AmethystFactoryClient {
    connectProvider(address: string, provider: Provider): Promise<AmethystFactoryClient>;

    connectSigner(signer: Signer): AmethystFactoryClient;

    setWaitConfirmations(num: number): void;

    /* ================ TRANSACTIONS ================ */

    /**
     * 创建AmethystDAO
     *
     * @param {Array<string>} initAccounts // account数组
     * @param {Array<number>} initShares // account对应的share权重数组
     * @param {number} initQuorum // proposal可执行的最少投票数
     * @param {number} initVotingDelay // 投票延时
     * @param {number} initVotingPeriod // 投票时间
     * @param {PayableOverrides} [config]
     * @return {Promise<CreateAmethystDAOEvent>} // 交易哈希和amethystDAO地址
     * @memberof AmethystFactoryClient
     */
    createAmethystDAO(
        initAccounts: Array<string>,
        initShares: Array<number>,
        initQuorum: number,
        initVotingDelay: number,
        initVotingPeriod: number,
        config?: PayableOverrides
    ): Promise<AmethystDAOCreatedEvent>;
}

export interface AmethystRoleManagementClient {
    connectProvider(address: string, provider: Provider): Promise<AmethystRoleManagementClient>;

    connectSigner(signer: Signer): AmethystRoleManagementClient;

    setWaitConfirmations(num: number): void;

    /*======== VIEWS ======*/

    /**
     * 检查person是否有此AmethystRole
     *
     * @param {string} person // person地址
     * @param {string} role // person角色
     * @param {CallOverrides} [config]
     * @return {Promise<boolean>} // 是否拥有该角色
     * @memberof AmethystRoleManagementClient
     */
    hasAmethystRole(person: string, role: string, config?: CallOverrides): Promise<boolean>;

    /* ================ TRANSACTIONS ================ */

    /**
     * 设置AmethystRole
     *
     * @param {string} person // person地址
     * @param {string} role // person角色
     * @param {boolean} enable // 是否拥有该角色
     * @param {number} timestamp // 时间戳
     * @param {string} signature // 签名
     * @param {PayableOverrides} [config]
     * @return {Promise<TransactionEvent>} // 交易事件
     * @memberof AmethystRoleManagementClient
     */
    setAmethystRole(
        person: string,
        role: string,
        enable: boolean,
        timestamp: number,
        signature: string,
        config?: PayableOverrides
    ): Promise<TransactionEvent>;

    /*======== UTILS ======*/

    /**
     * 使用私钥对设置AmethystRole的信息进行签名
     *
     * @param {string} privateKey // 私钥
     * @param {string} person // person地址
     * @param {string} role // person角色
     * @param {boolean} enable // 是否拥有该角色
     * @param {number} timestamp // 时间戳
     * @return {Promise<string>} // 签名
     * @memberof AmethystRoleManagementClient
     */
    signSetAmethystRoleMessage(
        privateKey: string,
        person: string,
        role: string,
        enable: boolean,
        timestamp: number
    ): Promise<string>;
}

export interface ERC721Client {
    connectProvider(address: string, provider: Provider): Promise<ERC721Client>;

    connectSigner(signer: Signer): ERC721Client;

    setWaitConfirmations(num: number): void;

    /* ================ VIEWS ================ */

    /**
     * 获取账户NFT余额
     *
     * @param {string} owner NFT所有者
     * @param {CallOverrides} [config] 
     * @return {Promise<BigNumber>} 返回NFT个数
     * @memberof ERC721Client
     */
    balanceOf(owner: string, config?: CallOverrides): Promise<BigNumber>;

    /**
     * 获取NFT所有者
     *
     * @param {BigNumber} tokenId NFT的tokenId
     * @param {CallOverrides} [config]
     * @return {Promise<string>} 返回所有者地址
     * @memberof ERC721Client
     */
    ownerOf(tokenId: BigNumber, config?: CallOverrides): Promise<string>;

    /**
     * 获取NFT名称
     *
     * @param {CallOverrides} [config]
     * @return {Promise<string>} 返回NFT名称
     * @memberof ERC721Client
     */
    name(config?: CallOverrides): Promise<string>;

    /**
     * 获取NFT标识符
     *
     * @param {CallOverrides} [config]
     * @return {Promise<string>} 返回NFT标识符
     * @memberof ERC721Client
     */
    symbol(config?: CallOverrides): Promise<string>;

    /**
     * 获取NFT的metadata资源的URI地址
     *
     * @param {BigNumber} tokenId NFT的tokenId
     * @param {CallOverrides} [config]
     * @return {Promise<string>} 返回URI地址
     * @memberof ERC721Client
     */
    tokenURI(tokenId: BigNumber, config?: CallOverrides): Promise<string>;

    /* ================ TRANSACTIONS ================ */

    /**
     * 转移NFT
     *
     * @param {string} from 转出者地址
     * @param {string} to 转入者地址
     * @param {BigNumber} tokenId NFT的tokenId
     * @param {PayableOverrides} [config]
     * @return {Promise<TransactionEvent>} 返回交易hash
     * @memberof ERC721Client
     */
    transferFrom(from: string, to: string, tokenId: BigNumber, config?: PayableOverrides): Promise<TransactionEvent>;
}

export interface RemixNFTClient extends ERC721Client {
    connectProvider(address: string, provider: Provider): Promise<RemixNFTClient>;

    connectSigner(signer: Signer): RemixNFTClient;

    setWaitConfirmations(num: number): void;

    /* ================ VIEWS ================ */

    /**
     * 获取NFT token的URI地址
     *
     * @param {BigNumber} tokenId NFT的tokenId
     * @param {CallOverrides} [config]
     * @return {Promise<string>} 返回URI地址
     * @memberof RemixNFTClient
     */
    tokenURI(tokenId: BigNumber, config?: CallOverrides): Promise<string>;

    /**
     * 获取NFT token的type
     *
     * @param {BigNumber} tokenId NFT的tokenId
     * @param {CallOverrides} [config]
     * @return {Promise<BigNumber>} 返回tokenType
     * @memberof RemixNFTClient
     */
    tokenType(tokenId: BigNumber, config?: CallOverrides): Promise<BigNumber>;

    /* ================ TRANSACTIONS ================ */

    /**
     * 购买NFT
     *
     * @param {string} account 购买地址
     * @param {Array<number>} tokenTypeArr tokenType数组
     * @param {BigNumber} price 购买价格
     * @param {number} timestamp 购买时间
     * @param {string} signature 签名
     * @param {PayableOverrides} [config]
     * @return {Promise<RemixNFTClaimedEvent>}  
     * @memberof RemixNFTClient
     */
    buy(
        account: string,
        tokenTypeArr: Array<number>,
        price: BigNumber,
        timestamp: number,
        signature: string,
        config?: PayableOverrides
    ): Promise<RemixNFTClaimedEvent>;

     /* ================ UTILS ================ */

    /**
     * 购买NFT签名
     *
     * @param {string} privateKey 签名私钥
     * @param {string} account 购买地址
     * @param {Array<number>} tokenTypeArr tokenType数组
     * @param {BigNumber} price 购买价格
     * @param {number} timestamp 购买时间
     * @return {Promise<string>} 返回签名
     * @memberof RemixNFTClient
     */
    signBuyMessage(
        privateKey: string,
        account: string,
        tokenTypeArr: Array<number>,
        price: BigNumber,
        timestamp: number
    ): Promise<string>;
}

FAQs

Package last updated on 03 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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