The PrepaidCardMarket API is used to manage the inventory prepaid cards in the market contract, whose purpose is to provision prepaid cards to consumers who buy them. This API is used within the layer 2 network in which the Card Protocol runs. The PrepaidCardMaket API can be obtained from getSDK() with a Web3 instance that is configured to operate on a layer 2 network (like Gnosis Chain or Sokol).

Example

import { getSDK } from "@cardstack/cardpay-sdk";
let web3 = new Web3(myProvider); // Layer 2 web3 instance
let prepaidCardMarket = await getSDK('PrepaidCardMarket', web3);

Hierarchy

  • PrepaidCardMarketClass

Constructors

Properties

layer2Web3: default
layer2Signer?: Signer

Cardpay

  • This call returns the prepaid card inventory for a particular SKU.

    Returns

    a promise for an array of PrepaidCardSafe objects (from Safes.View)

    Example

    let prepaidCards = await prepaidCardMarket.getInventory(sku1000SPENDCards);
    

    Parameters

    • sku: string

      The SKU in question

    • Optional marketAddress: string

    Returns Promise<PrepaidCardSafe[]>

Methods

  • This call returns whether or not the PrepaidCardMarket contract is currently paused.

    Example

    let isPaused = await prepaidCardMarket.isPaused();
    

    Parameters

    • Optional marketAddress: string

    Returns Promise<boolean>

  • This call obtains the details for the prepaid cards associated with a particular SKU.

    Example

    let {
    issuer,
    issuingToken,
    faceValue,
    customizationDID,
    askPrice // in the native units of the issuing token (e.g. wei)
    } = await prepaidCardMarket.getSKUInfo(sku1000SPENDCards);

    Parameters

    • sku: string

      The SKU in question

    • Optional marketAddress: string

      Optionally the address of the market contract (the default

    Returns Promise<undefined | {
        faceValue: number;
        issuer: string;
        issuingToken: string;
        customizationDID: string;
        askPrice: string;
    }>

  • This call adds the specified prepaid card address to the inventory.

    Returns

    a promise for a web3 transaction receipt.

    Example

    let result = await prepaidCardsMarket.addToInventory(fundingPrepaidCard, cardToAdd);
    

    Parameters

    • txnHash: string

    Returns Promise<SuccessfulTransactionReceipt>

  • Parameters

    • fundingPrepaidCard: string
    • prepaidCardToAdd: string
    • Optional marketAddress: string
    • Optional txnOptions: TransactionOptions
    • Optional contractOptions: ContractOptions

    Returns Promise<SuccessfulTransactionReceipt>

  • This call removes the specified prepaid card addresses from inventory and returns them back to the prepaid card issuer.

    Returns

    a promise for a web3 transaction receipt.

    Example

    let result = await prepaidCardsMarket.removeFromInventory(fundingPrepaidCard, cardsToRemove);
    

    Parameters

    • txnHash: string

    Returns Promise<SuccessfulTransactionReceipt>

  • Parameters

    • fundingPrepaidCard: string
    • prepaidCardAddresses: string[]
    • Optional marketAddress: string
    • Optional txnOptions: TransactionOptions
    • Optional contractOptions: ContractOptions

    Returns Promise<SuccessfulTransactionReceipt>

  • This call sets the ask price for the prepaid cards the belong to the specified SKU. The ask price is specified as a string in units of wei based on the issuing token for the prepaid cards in the specified SKU.

    Returns

    a promise for a web3 transaction receipt.

    Example

    let result = await prepaidCardMarket.setAsk(
    fundingPrepaidCard,
    sku1000SPENDCards,
    toWei("10"));

    Parameters

    • txnHash: string

    Returns Promise<SuccessfulTransactionReceipt>

  • Parameters

    • prepaidCard: string
    • sku: string
    • askPrice: string
    • Optional marketAddress: string
    • Optional txnOptions: TransactionOptions
    • Optional contractOptions: ContractOptions

    Returns Promise<SuccessfulTransactionReceipt>

  • Parameters

    • fundingPrepaidCard: string
    • prepaidCardToAdd: string
    • previousOwnerSignature: string
    • marketAddress: string
    • rate: string

    Returns Promise<SendPayload>

Generated using TypeDoc