constants.go raw

   1  package constants
   2  
   3  // shared constants used by multiple packages
   4  
   5  const (
   6  	TRANSACTION_TYPE_INCOMING = "incoming"
   7  	TRANSACTION_TYPE_OUTGOING = "outgoing"
   8  
   9  	TRANSACTION_STATE_PENDING  = "PENDING"
  10  	TRANSACTION_STATE_SETTLED  = "SETTLED"
  11  	TRANSACTION_STATE_FAILED   = "FAILED"
  12  	TRANSACTION_STATE_ACCEPTED = "ACCEPTED"
  13  
  14  	SWAP_TYPE_IN  = "in"
  15  	SWAP_TYPE_OUT = "out"
  16  
  17  	SWAP_STATE_PENDING  = "PENDING"
  18  	SWAP_STATE_SUCCESS  = "SUCCESS"
  19  	SWAP_STATE_FAILED   = "FAILED"
  20  	SWAP_STATE_REFUNDED = "REFUNDED"
  21  )
  22  
  23  const (
  24  	BUDGET_RENEWAL_DAILY   = "daily"
  25  	BUDGET_RENEWAL_WEEKLY  = "weekly"
  26  	BUDGET_RENEWAL_MONTHLY = "monthly"
  27  	BUDGET_RENEWAL_YEARLY  = "yearly"
  28  	BUDGET_RENEWAL_NEVER   = "never"
  29  )
  30  
  31  func GetBudgetRenewals() []string {
  32  	return []string{
  33  		BUDGET_RENEWAL_DAILY,
  34  		BUDGET_RENEWAL_WEEKLY,
  35  		BUDGET_RENEWAL_MONTHLY,
  36  		BUDGET_RENEWAL_YEARLY,
  37  		BUDGET_RENEWAL_NEVER,
  38  	}
  39  }
  40  
  41  const (
  42  	PAY_INVOICE_SCOPE       = "pay_invoice" // also covers pay_keysend and multi_* payment methods
  43  	GET_BALANCE_SCOPE       = "get_balance"
  44  	GET_INFO_SCOPE          = "get_info"
  45  	MAKE_INVOICE_SCOPE      = "make_invoice"
  46  	LOOKUP_INVOICE_SCOPE    = "lookup_invoice"
  47  	LIST_TRANSACTIONS_SCOPE = "list_transactions"
  48  	SIGN_MESSAGE_SCOPE      = "sign_message"
  49  	NOTIFICATIONS_SCOPE     = "notifications" // covers all notification types
  50  	SUPERUSER_SCOPE         = "superuser"
  51  )
  52  
  53  // limit encoded metadata length, otherwise relays may have trouble listing multiple transactions
  54  // given a relay limit of 512000 bytes and ideally being able to list 25 transactions,
  55  // each transaction would have to have a maximum size of 20480
  56  // accounting for encryption and other metadata in the response, this is set to 4096 characters
  57  const INVOICE_METADATA_MAX_LENGTH = 4096
  58  
  59  // errors used by NIP-47 and the transaction service
  60  const (
  61  	ERROR_INTERNAL               = "INTERNAL"
  62  	ERROR_NOT_IMPLEMENTED        = "NOT_IMPLEMENTED"
  63  	ERROR_QUOTA_EXCEEDED         = "QUOTA_EXCEEDED"
  64  	ERROR_INSUFFICIENT_BALANCE   = "INSUFFICIENT_BALANCE"
  65  	ERROR_UNAUTHORIZED           = "UNAUTHORIZED"
  66  	ERROR_EXPIRED                = "EXPIRED"
  67  	ERROR_RESTRICTED             = "RESTRICTED"
  68  	ERROR_BAD_REQUEST            = "BAD_REQUEST"
  69  	ERROR_NOT_FOUND              = "NOT_FOUND"
  70  	ERROR_UNSUPPORTED_ENCRYPTION = "UNSUPPORTED_ENCRYPTION"
  71  	ERROR_OTHER                  = "OTHER"
  72  )
  73  
  74  const (
  75  	ENCRYPTION_TYPE_NIP04    = "nip04"
  76  	ENCRYPTION_TYPE_NIP44_V2 = "nip44_v2"
  77  )
  78  
  79  const METADATA_APPSTORE_APP_ID_KEY = "app_store_app_id"
  80  
  81  const SUBWALLET_APPSTORE_APP_ID = "uncle-jim"
  82  
  83  const (
  84  	BITCOIN_DISPLAY_FORMAT_SATS   = "sats"
  85  	BITCOIN_DISPLAY_FORMAT_BIP177 = "bip177"
  86  )
  87