@namespace("stellar.1") protocol remote { import idl "../keybase1" as keybase1; import idl "common.avdl"; @typedef("string") record ChatConversationID {} record PaymentDirectPost { keybase1.DeviceID fromDeviceID; union { null, keybase1.UserVersion } to; // Nil for payments to stellar addresses string displayAmount; string displayCurrency; string noteB64; // b64-encoded EncryptedNote or empty string. string signedTransaction; // If quickReturn == true then the RPC can return success // while the payment is still pending on the stellar network. boolean quickReturn; // if not empty, stellard will inform gregord about this payment's // status changes along with this conversation ID union { null, ChatConversationID } chatConversationID; string batchID; // if this payment is part of a batch } record PaymentRelayPost { keybase1.DeviceID fromDeviceID; union { null, keybase1.UserVersion } to; // Nil for SBS string toAssertion; // Ex: 'mlsteele' or 'maxtaco@reddit' AccountID relayAccount; // Address where the funds will be held keybase1.TeamID teamID; // Impteam ID string displayAmount; string displayCurrency; string boxB64; // b64-encoded EncryptedRelaySecret string signedTransaction; // Funding tx boolean quickReturn; // Same as PaymentDirectPost.quickReturn but success refers to the funding of the relay. // if not empty, stellard will inform gregord about this payment's // status changes along with this conversation ID union { null, ChatConversationID } chatConversationID; string batchID; // if this payment is part of a batch } record RelayClaimPost { KeybaseTransactionID keybaseID; RelayDirection dir; string signedTransaction; // Claim or yank tx union { null, string } autoClaimToken; // Optional. Filled if this is an autoclaim. } record PathPaymentPost { keybase1.DeviceID fromDeviceID; union { null, keybase1.UserVersion } to; // Nil for payments to stellar addresses string noteB64; // b64-encoded EncryptedNote or empty string. string signedTransaction; // If quickReturn == true then the RPC can return success // while the payment is still pending on the stellar network. boolean quickReturn; // if not empty, stellard will inform gregord about this payment's // status changes along with this conversation ID union { null, ChatConversationID } chatConversationID; } record DirectOp { string noteB64; // b64-encoded EncryptedNote or empty string. } record RelayOp { string toAssertion; // Ex: 'mlsteele' or 'maxtaco@reddit' AccountID relayAccount; // Address where the funds will be held keybase1.TeamID teamID; // Impteam ID string boxB64; // b64-encoded EncryptedRelaySecret } record PaymentOp { union { null, keybase1.UserVersion } to; // nil for SBS/stellar address union { null, DirectOp } direct; // one of direct or relay will be non-nil union { null, RelayOp } relay; } record PaymentMultiPost { keybase1.DeviceID fromDeviceID; string signedTransaction; array operations; string batchID; // end-to-end identifier } enum PaymentSummaryType { NONE_0, STELLAR_1, DIRECT_2, RELAY_3 } variant PaymentSummary switch (PaymentSummaryType typ) { case STELLAR: PaymentSummaryStellar; // The only record of this tx is from horizon case DIRECT: PaymentSummaryDirect; case RELAY: PaymentSummaryRelay; } // Info from horizon record PaymentSummaryStellar { TransactionID txID; AccountID from; AccountID to; string amount; // amount of asset Asset asset; TimeMs ctime; // time on the network string cursorToken; boolean unread; boolean isInflation; union { null, string } inflationSource; string sourceAmountMax; string sourceAmountActual; Asset sourceAsset; boolean isAdvanced; // true for non-payment transactions string summaryAdvanced; // one-line summary of the advanced tx array operations; // string representations of each operation in the tx union { null, PaymentTrustlineLocal } trustline; // this tx is only a trust line change. } record PaymentSummaryDirect { KeybaseTransactionID kbTxID; TransactionID txID; TransactionStatus txStatus; string txErrMsg; AccountID fromStellar; keybase1.UserVersion from; keybase1.DeviceID fromDeviceID; AccountID toStellar; union { null, keybase1.UserVersion } to; string amount; // amount of asset Asset asset; union { null, string } displayAmount; union { null, string } displayCurrency; string noteB64; // b64-encoded EncryptedNote or empty string. string fromDisplayAmount; string fromDisplayCurrency; string toDisplayAmount; string toDisplayCurrency; TimeMs ctime; // ctime in keybase db TimeMs rtime; // time of last status update string cursorToken; boolean unread; boolean fromPrimary; string batchID; boolean fromAirdrop; string sourceAmountMax; string sourceAmountActual; Asset sourceAsset; } record PaymentSummaryRelay { KeybaseTransactionID kbTxID; // Funding tx info. TransactionID txID; TransactionStatus txStatus; string txErrMsg; AccountID fromStellar; keybase1.UserVersion from; keybase1.DeviceID fromDeviceID; union { null, keybase1.UserVersion } to; string toAssertion; // Ex: 'mlsteele' or 'maxtaco@reddit' AccountID relayAccount; string amount; // amount of XLM union { null, string } displayAmount; union { null, string } displayCurrency; TimeMs ctime; // ctime in keybase db TimeMs rtime; // time of last status update of fund tx string boxB64; // b64-encoded EncryptedRelaySecret keybase1.TeamID teamID; // Impteam ID // Summary of the most relevant claim. Either the successful one or latest pending. union { null, ClaimSummary } claim; string cursorToken; string batchID; boolean fromAirdrop; } record ClaimSummary { TransactionID txID; TransactionStatus txStatus; string txErrMsg; RelayDirection dir; AccountID toStellar; keybase1.UserVersion to; // who claimed it } record PaymentDetails { PaymentSummary summary; string memo; string memoType; @lint("ignore") string externalTxURL; // link to external web page with tx details string feeCharged; array pathIntermediate; // for payment paths, the additional hops it took } array balances(keybase1.UserVersion caller, AccountID accountID); record AccountDetails { AccountID accountID; string seqno; array balances; int subentryCount; // number of entries in the ledger (which raise minimum balance) string available; // for native XLM the amount that is available to send (amount - min balance) array reserves; union { null, TransactionID } readTransactionID; int unreadPayments; // number of STELLAR payments that are "unread" string displayCurrency; // user configurable, defaults to "USD" union { null, AccountID } inflationDestination; } AccountDetails details(keybase1.UserVersion caller, AccountID accountID, boolean includeMulti, boolean includeAdvanced); record PaymentsPage { array payments; union { null, PageCursor } cursor; union { null, TransactionID } oldestUnread; } // skipPending: don't include pending payments in the result // includeMulti: include payments from multi-operation txs when possible // includeAdvanced: include advanced tx summaries in results PaymentsPage recentPayments(keybase1.UserVersion caller, AccountID accountID, union { null, PageCursor } cursor, int limit, boolean skipPending, boolean includeMulti, boolean includeAdvanced); array pendingPayments(keybase1.UserVersion caller, AccountID accountID, int limit); // markAsRead will mark as "read" all the payments in an account created at or before the time // of the payment referenced by `mostRecentID`. void markAsRead(keybase1.UserVersion caller, AccountID accountID, TransactionID mostRecentID); // txID can be either a keybase or stellar transaction ID. PaymentDetails paymentDetails(keybase1.UserVersion caller, AccountID accountID, string txID); // js can't handle uint64, so returning a string string accountSeqno(keybase1.UserVersion caller, AccountID accountID); PaymentResult submitPayment(keybase1.UserVersion caller, PaymentDirectPost payment); PaymentResult submitRelayPayment(keybase1.UserVersion caller, PaymentRelayPost payment); RelayClaimResult submitRelayClaim(keybase1.UserVersion caller, RelayClaimPost claim); PaymentResult submitPathPayment(keybase1.UserVersion caller, PathPaymentPost payment); record SubmitMultiRes { TransactionID txID; } SubmitMultiRes submitMultiPayment(keybase1.UserVersion caller, PaymentMultiPost payment); // Acquire the UV-specific lock for autoclaims. // Returns a token, or an empty string if the lock is unavailable. string acquireAutoClaimLock(keybase1.UserVersion caller); void releaseAutoClaimLock(keybase1.UserVersion caller, string token); record AutoClaim { KeybaseTransactionID kbTxID; } union { null, AutoClaim } nextAutoClaim(keybase1.UserVersion caller); // ask the stellar network whether the master key for the account has power boolean isMasterKeyActive(keybase1.UserVersion caller, AccountID accountID); record RequestPost { // User being asked for payment - Keybase user or an assertion. If // `toUser` is not null, `toAssertion` shall be the username. For // SBS, `toUser` is null, and `toAssertion` is social assertion. union { null, keybase1.UserVersion } toUser; string toAssertion; // Amount of XLM or other Stellar asset, or outside currency. string amount; // User can either ask for specific amount of given Stellar asset, // or an amount of outside currency (user making the payment does // the conversion in this case). union { null, Asset } asset; union { null, OutsideCurrencyCode } currency; } KeybaseRequestID submitRequest(keybase1.UserVersion caller, RequestPost request); record RequestDetails { KeybaseRequestID id; // User asking for payment - creator of the request. keybase1.UserVersion fromUser; // User being asked for payment - Keybase user or SBS assertion. union { null, keybase1.UserVersion } toUser; string toAssertion; string amount; union { null, Asset } asset; union { null, OutsideCurrencyCode } currency; string fromDisplayAmount; string fromDisplayCurrency; string toDisplayAmount; string toDisplayCurrency; // Payment ID if funded, empty if not funded. KeybaseTransactionID fundingKbTxID; RequestStatus status; } RequestDetails requestDetails(keybase1.UserVersion caller, KeybaseRequestID reqID); void cancelRequest(keybase1.UserVersion caller, KeybaseRequestID reqID); void setInflationDestination(keybase1.UserVersion caller, string signedTransaction); string ping(); record TimeboundsRecommendation { @jsonkey("time_now") keybase1.UnixTime timeNow; // server's time right now @jsonkey("timeout") int64 timeout; // tx timeout recommended by the server } record NetworkOptions { uint64 baseFee; } NetworkOptions networkOptions(keybase1.UserVersion caller); record DetailsPlusPayments { AccountDetails details; PaymentsPage recentPayments; array pendingPayments; } DetailsPlusPayments detailsPlusPayments(keybase1.UserVersion caller, AccountID accountID, boolean includeAdvanced); array allDetailsPlusPayments(keybase1.UserVersion caller); // search by either an assetCode or an issuerAccountID (or both) to get back matches from stellard/horizon array assetSearch(string assetCode, string issuerAccountID); // search by user search string array fuzzyAssetSearch(keybase1.UserVersion caller, string searchString); AssetListResult listPopularAssets(keybase1.UserVersion caller); void changeTrustline(keybase1.UserVersion caller, string signedTransaction); record PaymentPathQuery { AccountID source; AccountID destination; Asset sourceAsset; Asset destinationAsset; string amount; } PaymentPath findPaymentPath(keybase1.UserVersion caller, PaymentPathQuery query); void postAnyTransaction(keybase1.UserVersion caller, string signedTransaction); }