Git Product home page Git Product logo

bat-native-confirmations's Introduction

BAT Native Confirmations

API

Native

CreateInstance should be called to initialize Confirmations

static Confirmations* CreateInstance(
        ConfirmationsClient* confirmations_client)

SetWalletInfo should be called by Ledger to set the wallet info

void SetWalletInfo(
    const bool is_ready)

SetCatalogIssuers should be called by Ads to set the catalog issuers

void SetCatalogIssuers(
    std::unique_ptr<IssuersInfo> info)

GetTransactionHistory should be called to get transaction history

void GetTransactionHistory(
    const uint64_t from_timestamp_in_seconds,
    const uint64_t to_timestamp_in_seconds,
    OnGetTransactionHistoryCallback callback)

AdSustained should be called by Ads to be rewarded for viewing an Ad

void AdSustained(
    std::unique_ptr<NotificationInfo> info)

OnTimer should be called when a timer is triggered

void OnTimer(
    const uint32_t timer_id)

Client

SetConfirmationsIsReady should notify Ads if Confirmations is ready

void SetConfirmationsIsReady(
    const bool is_ready)

SetTimer should create a timer to trigger after the time offset specified in seconds. If the timer was created successfully a unique identifier should be returned, otherwise returns 0

uint32_t SetTimer(
    uint64_t time_offset,
    uint32_t* timer_id)

KillTimer should destroy the timer associated with the specified timer identifier

void KillTimer(
    const uint32_t timer_id)

LoadURL should start a URL request

void LoadURL(
    const std::string& url,
    const std::vector<std::string>& headers,
    const std::string& content,
    const std::string& content_type,
    const URLRequestMethod method,
    URLRequestCallback callback)

SaveState should save a value to persistent storage

void SaveState(
    const std::string& name,
    const std::string& value,
    OnSaveCallback callback)

LoadState should load a value from persistent storage

void LoadState(
    const std::string& name,
    OnLoadCallback callback)

ResetState should reset a previously saved value, i.e. remove the file from persistent storage

void Reset(
    const std::string& name,
    OnResetCallback callback)

Log should log diagnostic information to the console

std::unique_ptr<LogStream> Log(
    const char* file,
    const int line,
    const LogLevel log_level) const

Command-line Switches

Use production Ads Serve as defined by PRODUCTION_SERVER in static_values.h. Default for Official Builds

--rewards=staging=false

Use staging Ads Serve as defined by STAGING_SERVER in static_values.h. Default for non Office Builds, i.e. Debug

--rewards=staging=true

Enable diagnostic logging, where # should set to a minimum log level. Valid values are from 0 to 3 where INFO = 0, WARNING = 1, ERROR = 2 and FATAL = 3. So if you want INFO, WARNING and ERROR you would choose 2

--enable-logging=stderr --log-level=#

i.e. to launch using Staging Server and logging for INFO, WARNING and ERROR on macOS open the Terminal application and enter the below commands:

cd /Applications

cd Brave\ Browser\ Dev.app/

cd Contents

./Brave\ Browser\ Dev --rewards=staging=false --enable-logging=stderr --log-level=2

Unit Tests

npm run test -- brave_unit_tests --filter=Confirmations*

bat-native-confirmations's People

Contributors

bridiver avatar emerick avatar kevinlawler avatar nejczdovc avatar tmancey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.