Update Payment

PATCH /shared-wallets/{walletId}/payment-script-template

status: stable

Update payment script template for a given shared wallet by updating/adding account public key for cosigner. Updating the shared wallet account key results in an error. Also updating is enabled only for incomplete shared wallet, ie., the wallet that has a missing account public key for any cosigner.

Path parameters

  • walletId string(hex) Required

    Minimum length is 40, maximum length is 40.

application/json

Responses

  • 503 application/json

    No meta

    Hide response attributes Show response attributes object
    • message string Required

      Indicates that it was not possible to find any metadata for the given wallet within the database.

      May occur when a shared wallet has not yet become active after being in the incomplete state.

    • code string Required

      Value is wallet_metadata_not_found.

  • 406 application/json

    Not Acceptable

    Hide response attributes Show response attributes object
    • message string Required

      May occur when providing an invalid 'Accept' header.

    • code string Required

      Value is not_acceptable.

  • 404 application/json

    Not Found

    Hide response attributes Show response attributes object
    • message string Required

      May occur when a given walletId does not match with any known wallets (because it has been deleted, or has never existed).

    • code string Required

      Value is no_such_wallet.

    • info object
      Hide info attribute Show info attribute object
      • wallet_id string(hex) Required

        A unique identifier for the wallet

        Minimum length is 40, maximum length is 40.

  • 400 application/json

    Bad Request

    Hide response attributes Show response attributes object
    • message string Required

      May occur when a request is not well-formed; that is, it fails to parse successfully. This could be the case when some required parameters are missing or, when malformed values are provided.

    • code string Required

      Value is bad_request.

  • 403 application/json

    Forbidden

    One of:
    Hide attributes Show attributes
    • message string Required

      Returned when a user tries to add cosigner key to a shared wallet but the same key is already present in a given template.

    • code string Required

      Value is shared_wallet_key_already_exists.

  • 200 application/json

    Ok

    One of:
    Hide attributes Show attributes
    • id string(hex) Required

      A unique identifier for the wallet

      Minimum length is 40, maximum length is 40.

    • name string Required

      Minimum length is 1, maximum length is 255.

    • account_index string Required

      An individual segment within a derivation path.

      The H suffix indicates a Hardened child private key, which means that children of this key cannot be derived from the public key. Indices without a H suffix are called Soft.

    • address_pool_gap integer Required

      Number of consecutive unused addresses allowed.

      IMPORTANT DISCLAIMER: Using values other than 20 automatically makes your wallet invalid with regards to BIP-44 address discovery. It means that you will not be able to fully restore your wallet in a different software which is strictly following BIP-44.

      Beside, using large gaps is not recommended as it may induce important performance degradations. Use at your own risks.

      IMPORTANT DISCLAIMER 2: There is no way to import addresses generated outside (e.g. using cardano-addresses) into the wallet. Wallet only discovers transactions on its used and unused addresses that are within its currently seen address_pool_gap. Transactions on addresses that "belong" to the wallet but happen to be beyond its address_pool_gap will not be visible to the wallet. This is a technical limitation of the industry standard BIP-44. See also CIP-1852.

      Minimum value is 10, maximum value is 100000. Default value is 20.

    • Hide payment_script_template attributes Show payment_script_template attributes object
      • cosigners object Required

        Map of cosigners and their account public keys. Use key as in &cosigner, eg. "cosigner#"

        Hide cosigners attributes Show cosigners attributes object
      • template string | object Required

        One of:

        Leaf value for a script designating a cosigner co-sharing the script.

        Format should match the following pattern: ^(cosigner#)[0-9]*$.

    • Hide delegation_script_template attributes Show delegation_script_template attributes object
      • cosigners object Required

        Map of cosigners and their account public keys. Use key as in &cosigner, eg. "cosigner#"

        Hide cosigners attributes Show cosigners attributes object
      • template string | object Required

        One of:

        Leaf value for a script designating a cosigner co-sharing the script.

        Format should match the following pattern: ^(cosigner#)[0-9]*$.

    • state object Required
      Hide state attribute Show state attribute object
      • status string Required

        An incomplete shared wallet does not have a complete set of keys, so the only possible status is incomplete.

        Value is incomplete.

PATCH /shared-wallets/{walletId}/payment-script-template
curl \
 --request PATCH https://localhost:8090/v2/shared-wallets/{walletId}/payment-script-template \
 --header "Content-Type: application/json" \
 --data '[{"cosigner#0":"acct_shared_xvk1z8kc04yh544ksc9h2yhp7p6qwpf6syv5qnm8sgnhdne5z2esht5cwssxsec2wzw3nhxm2d9ph4s6ldmqdvxa0zuxzmukpajhyc7flug3te037"}]'
Request example
[
  {
    "cosigner#0": "acct_shared_xvk1z8kc04yh544ksc9h2yhp7p6qwpf6syv5qnm8sgnhdne5z2esht5cwssxsec2wzw3nhxm2d9ph4s6ldmqdvxa0zuxzmukpajhyc7flug3te037"
  }
]
Response examples (503)
{
  "message": "string",
  "code": "wallet_metadata_not_found"
}
Response examples (406)
{
  "message": "string",
  "code": "not_acceptable"
}
Response examples (404)
{
  "message": "string",
  "code": "no_such_wallet",
  "info": {
    "wallet_id": "2512a00e9653fe49a44a5886202e24d77eeb998f"
  }
}
Response examples (400)
{
  "message": "string",
  "code": "bad_request"
}
{
  "message": "string",
  "code": "shared_wallet_key_already_exists"
}
{
  "message": "string",
  "code": "shared_wallet_no_delegation_template"
}
{
  "message": "string",
  "code": "shared_wallet_active"
}
{
  "message": "string",
  "code": "shared_wallet_no_such_cosigner",
  "info": {
    "cosigner_index": 42,
    "credential_type": "delegation"
  }
}
{
  "message": "string",
  "code": "shared_wallet_cannot_update_key"
}
{
  "id": "2512a00e9653fe49a44a5886202e24d77eeb998f",
  "name": "Alan's Wallet",
  "account_index": "1852H",
  "address_pool_gap": 20,
  "payment_script_template": {
    "cosigners": [
      {
        "cosigner#0": "acct_shared_xvk1z8kc04yh544ksc9h2yhp7p6qwpf6syv5qnm8sgnhdne5z2esht5cwssxsec2wzw3nhxm2d9ph4s6ldmqdvxa0zuxzmukpajhyc7flug3te037"
      }
    ],
    "template": "string"
  },
  "delegation_script_template": {
    "cosigners": [
      {
        "cosigner#0": "acct_shared_xvk1z8kc04yh544ksc9h2yhp7p6qwpf6syv5qnm8sgnhdne5z2esht5cwssxsec2wzw3nhxm2d9ph4s6ldmqdvxa0zuxzmukpajhyc7flug3te037"
      }
    ],
    "template": "string"
  },
  "state": {
    "status": "incomplete"
  }
}
{
  "id": "2512a00e9653fe49a44a5886202e24d77eeb998f",
  "name": "Alan's Wallet",
  "account_index": "1852H",
  "address_pool_gap": 20,
  "passphrase": {
    "last_updated_at": "2019-02-27T14:46:45Z"
  },
  "payment_script_template": {
    "cosigners": [
      {
        "cosigner#0": "acct_shared_xvk1z8kc04yh544ksc9h2yhp7p6qwpf6syv5qnm8sgnhdne5z2esht5cwssxsec2wzw3nhxm2d9ph4s6ldmqdvxa0zuxzmukpajhyc7flug3te037"
      }
    ],
    "template": "string"
  },
  "delegation_script_template": {
    "cosigners": [
      {
        "cosigner#0": "acct_shared_xvk1z8kc04yh544ksc9h2yhp7p6qwpf6syv5qnm8sgnhdne5z2esht5cwssxsec2wzw3nhxm2d9ph4s6ldmqdvxa0zuxzmukpajhyc7flug3te037"
      }
    ],
    "template": "string"
  },
  "balance": {
    "available": {
      "quantity": 42000000,
      "unit": "lovelace"
    },
    "reward": {
      "quantity": 42000000,
      "unit": "lovelace"
    },
    "total": {
      "quantity": 42000000,
      "unit": "lovelace"
    }
  },
  "assets": {
    "available": [
      {
        "policy_id": "65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b",
        "asset_name": "string",
        "quantity": 42
      }
    ],
    "total": [
      {
        "policy_id": "65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b",
        "asset_name": "string",
        "quantity": 42
      }
    ]
  },
  "delegation": {
    "active": {
      "status": "delegating",
      "target": "1423856bc91c49e928f6f30f4e8d665d53eb4ab6028bd0ac971809d514c92db1"
    },
    "next": [
      {
        "status": "not_delegating",
        "changes_at": {
          "epoch_number": 14,
          "epoch_start_time": "2020-01-22T10:06:39Z"
        }
      }
    ]
  },
  "state": {
    "status": "ready"
  },
  "tip": {
    "absolute_slot_number": 8086,
    "slot_number": 1337,
    "epoch_number": 14,
    "time": "2019-02-27T14:46:45Z",
    "height": {
      "quantity": 1337,
      "unit": "block"
    }
  }
}