github.com/algorand/go-algorand-sdk@v1.24.0/client/kmd/requests.go (about)

     1  package kmd
     2  
     3  import (
     4  	"golang.org/x/crypto/ed25519"
     5  
     6  	"github.com/algorand/go-algorand-sdk/types"
     7  )
     8  
     9  // DefaultWalletDriver is the wallet backend that kmd will use by default
    10  const DefaultWalletDriver = "sqlite"
    11  
    12  // APIV1Request is the interface that all API V1 requests must satisfy
    13  type APIV1Request interface{}
    14  
    15  // APIV1RequestEnvelope is a common envelope that all API V1 requests must embed
    16  type APIV1RequestEnvelope struct {
    17  	_struct struct{} `codec:",omitempty,omitemptyarray"`
    18  }
    19  
    20  // VersionsRequest is the request for `GET /versions`
    21  type VersionsRequest struct {
    22  	_struct struct{} `codec:",omitempty,omitemptyarray"`
    23  }
    24  
    25  // ListWalletsRequest is the request for `GET /v1/wallets`
    26  type ListWalletsRequest struct {
    27  	APIV1RequestEnvelope
    28  }
    29  
    30  // CreateWalletRequest is the request for `POST /v1/wallet`
    31  type CreateWalletRequest struct {
    32  	APIV1RequestEnvelope
    33  	WalletName          string                    `json:"wallet_name"`
    34  	WalletDriverName    string                    `json:"wallet_driver_name"`
    35  	WalletPassword      string                    `json:"wallet_password"`
    36  	MasterDerivationKey types.MasterDerivationKey `json:"master_derivation_key"`
    37  }
    38  
    39  // InitWalletHandleRequest is the request for `POST /v1/wallet/init`
    40  type InitWalletHandleRequest struct {
    41  	APIV1RequestEnvelope
    42  	WalletID       string `json:"wallet_id"`
    43  	WalletPassword string `json:"wallet_password"`
    44  }
    45  
    46  // ReleaseWalletHandleRequest is the request for `POST /v1/wallet/release`
    47  type ReleaseWalletHandleRequest struct {
    48  	APIV1RequestEnvelope
    49  	WalletHandleToken string `json:"wallet_handle_token"`
    50  }
    51  
    52  // RenewWalletHandleRequest is the request for `POST /v1/wallet/renew`
    53  type RenewWalletHandleRequest struct {
    54  	APIV1RequestEnvelope
    55  	WalletHandleToken string `json:"wallet_handle_token"`
    56  }
    57  
    58  // RenameWalletRequest is the request for `POST /v1/wallet/rename`
    59  type RenameWalletRequest struct {
    60  	APIV1RequestEnvelope
    61  	WalletID       string `json:"wallet_id"`
    62  	WalletPassword string `json:"wallet_password"`
    63  	NewWalletName  string `json:"wallet_name"`
    64  }
    65  
    66  // GetWalletRequest is the request for `POST /v1/wallet/info`
    67  type GetWalletRequest struct {
    68  	APIV1RequestEnvelope
    69  	WalletHandleToken string `json:"wallet_handle_token"`
    70  }
    71  
    72  // ExportMasterDerivationKeyRequest is the request for `POST /v1/master_key/export`
    73  type ExportMasterDerivationKeyRequest struct {
    74  	APIV1RequestEnvelope
    75  	WalletHandleToken string `json:"wallet_handle_token"`
    76  	WalletPassword    string `json:"wallet_password"`
    77  }
    78  
    79  // ImportKeyRequest is the request for `POST /v1/key/import`
    80  type ImportKeyRequest struct {
    81  	APIV1RequestEnvelope
    82  	WalletHandleToken string             `json:"wallet_handle_token"`
    83  	PrivateKey        ed25519.PrivateKey `json:"private_key"`
    84  }
    85  
    86  // ExportKeyRequest is the request for `POST /v1/key/export`
    87  type ExportKeyRequest struct {
    88  	APIV1RequestEnvelope
    89  	WalletHandleToken string `json:"wallet_handle_token"`
    90  	Address           string `json:"address"`
    91  	WalletPassword    string `json:"wallet_password"`
    92  }
    93  
    94  // GenerateKeyRequest is the request for `POST /v1/key`
    95  type GenerateKeyRequest struct {
    96  	APIV1RequestEnvelope
    97  	WalletHandleToken string `json:"wallet_handle_token"`
    98  	DisplayMnemonic   bool   `json:"display_mnemonic"`
    99  }
   100  
   101  // DeleteKeyRequest is the request for `DELETE /v1/key`
   102  type DeleteKeyRequest struct {
   103  	APIV1RequestEnvelope
   104  	WalletHandleToken string `json:"wallet_handle_token"`
   105  	Address           string `json:"address"`
   106  	WalletPassword    string `json:"wallet_password"`
   107  }
   108  
   109  // ListKeysRequest is the request for `POST /v1/keys/list`
   110  type ListKeysRequest struct {
   111  	APIV1RequestEnvelope
   112  	WalletHandleToken string `json:"wallet_handle_token"`
   113  }
   114  
   115  // SignTransactionRequest is the request for `POST /v1/transaction/sign`
   116  type SignTransactionRequest struct {
   117  	APIV1RequestEnvelope
   118  	WalletHandleToken string            `json:"wallet_handle_token"`
   119  	Transaction       []byte            `json:"transaction"`
   120  	WalletPassword    string            `json:"wallet_password"`
   121  	PublicKey         ed25519.PublicKey `json:"public_key"`
   122  }
   123  
   124  // ListMultisigRequest is the request for `POST /v1/multisig/list`
   125  type ListMultisigRequest struct {
   126  	APIV1RequestEnvelope
   127  	WalletHandleToken string `json:"wallet_handle_token"`
   128  }
   129  
   130  // ImportMultisigRequest is the request for `POST /v1/multisig/import`
   131  type ImportMultisigRequest struct {
   132  	APIV1RequestEnvelope
   133  	WalletHandleToken string              `json:"wallet_handle_token"`
   134  	Version           uint8               `json:"multisig_version"`
   135  	Threshold         uint8               `json:"threshold"`
   136  	PKs               []ed25519.PublicKey `json:"pks"`
   137  }
   138  
   139  // ExportMultisigRequest is the request for `POST /v1/multisig/export`
   140  type ExportMultisigRequest struct {
   141  	APIV1RequestEnvelope
   142  	WalletHandleToken string `json:"wallet_handle_token"`
   143  	Address           string `json:"address"`
   144  	WalletPassword    string `json:"wallet_password"`
   145  }
   146  
   147  // DeleteMultisigRequest is the request for `POST /v1/multisig/delete`
   148  type DeleteMultisigRequest struct {
   149  	APIV1RequestEnvelope
   150  	WalletHandleToken string `json:"wallet_handle_token"`
   151  	Address           string `json:"address"`
   152  	WalletPassword    string `json:"wallet_password"`
   153  }
   154  
   155  // SignMultisigTransactionRequest is the request for `POST /v1/multisig/sign`
   156  type SignMultisigTransactionRequest struct {
   157  	APIV1RequestEnvelope
   158  	WalletHandleToken string            `json:"wallet_handle_token"`
   159  	Transaction       []byte            `json:"transaction"`
   160  	PublicKey         ed25519.PublicKey `json:"public_key"`
   161  	PartialMsig       types.MultisigSig `json:"partial_multisig"`
   162  	WalletPassword    string            `json:"wallet_password"`
   163  }