repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/fungible/src/contract.rs | examples/fungible/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use fungible::{
FungibleOperation, FungibleResponse, FungibleTokenAbi, InitialState, Message, Parameters,
};
use linera_sdk::{
linera_base_types::{Account, AccountOwner, Amount... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/fungible/src/lib.rs | examples/fungible/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/* ABI of the Fungible Token Example Application */
use async_graphql::scalar;
pub use linera_sdk::abis::fungible::*;
use linera_sdk::linera_base_types::{Account, AccountOwner, Amount};
use serde::{Deserialize, Serialize};
#[cfg(all(any(test,... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/fungible/src/state.rs | examples/fungible/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use fungible::{InitialState, OwnerSpender};
use linera_sdk::{
linera_base_types::{AccountOwner, Amount},
views::{linera_views, MapView, RootView, ViewStorageContext},
};
/// The application state.
#[derive(RootView)]
#[view(context = ... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/fungible/src/service.rs | examples/fungible/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::sync::Arc;
use async_graphql::{EmptySubscription, Object, Request, Response, Schema};
use fungible::{OwnerSpender, Parameters};
use linera_sdk::{
abis::fungible::Fungible... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/fungible/tests/cross_chain.rs | examples/fungible/tests/cross_chain.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Integration tests for the Fungible Token application.
#![cfg(not(target_arch = "wasm32"))]
use fungible::{FungibleTokenAbi, InitialState, InitialStateBuilder, Parameters};
use linera_sdk::{
abis::fungible::FungibleOperation,
line... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/amm/src/contract.rs | examples/amm/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use amm::{AmmAbi, Message, Operation, Parameters};
use linera_sdk::{
abis::fungible::{FungibleOperation, FungibleResponse, FungibleTokenAbi},
linera_base_types::{Account, Accou... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/amm/src/lib.rs | examples/amm/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! The ABI for the Automated Market Maker (AMM) Example Application */
use async_graphql::{scalar, Request, Response};
use linera_sdk::{
abis::fungible::FungibleTokenAbi,
graphql::GraphQLMutationRoot,
linera_base_types::{AccountO... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/amm/src/state.rs | examples/amm/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use linera_sdk::{
linera_base_types::{Account, Amount},
views::{linera_views, MapView, RegisterView, RootView, ViewStorageContext},
};
#[derive(RootView, async_graphql::SimpleObject)]
#[view(context = ViewStorageContext)]
pub struct A... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/amm/src/service.rs | examples/amm/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::sync::Arc;
use amm::{Operation, Parameters};
use async_graphql::{EmptySubscription, Request, Response, Schema};
use linera_sdk::{
graphql::GraphQLMutationRoot as _, liner... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/rfq/src/contract.rs | examples/rfq/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use fungible::{FungibleOperation, FungibleTokenAbi};
use linera_sdk::{
linera_base_types::{
Account, AccountOwner, Amount, ApplicationPermissions, ChainId, ChainOwnership,
... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/rfq/src/lib.rs | examples/rfq/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! ABI of the Requests For Quotes Example Application */
use async_graphql::{scalar, InputObject, Request, Response, SimpleObject};
use linera_sdk::{
graphql::GraphQLMutationRoot,
linera_base_types::{
Account, AccountOwner, A... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/rfq/src/state.rs | examples/rfq/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use async_graphql::{InputObject, SimpleObject, Union};
use linera_sdk::{
linera_base_types::{AccountOwner, Amount, ChainId},
views::{linera_views, MapView, RegisterView, RootView, ViewStorageContext},
};
use rfq::{RequestId, TokenPair,... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/rfq/src/service.rs | examples/rfq/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
#[allow(unused)]
mod state;
use std::sync::Arc;
use async_graphql::{EmptySubscription, Request, Response, Schema};
use linera_sdk::{
graphql::GraphQLMutationRoot as _, linera_base_types::Wit... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/counter-no-graphql/src/contract.rs | examples/counter-no-graphql/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use counter_no_graphql::{CounterNoGraphQlAbi, CounterOperation};
use linera_sdk::{
linera_base_types::WithContractAbi,
views::{RootView, View},
Contract, ContractRuntime,
}... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/counter-no-graphql/src/lib.rs | examples/counter-no-graphql/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! ABI of the Counter Example Application that does not use GraphQL */
use linera_sdk::linera_base_types::{ContractAbi, ServiceAbi};
use serde::{Deserialize, Serialize};
pub struct CounterNoGraphQlAbi;
impl ContractAbi for CounterNoGraphQl... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/counter-no-graphql/src/state.rs | examples/counter-no-graphql/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use linera_sdk::views::{linera_views, RegisterView, RootView, ViewStorageContext};
/// The application state.
#[derive(RootView)]
#[view(context = ViewStorageContext)]
pub struct CounterState {
pub value: RegisterView<u64>,
}
| rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/counter-no-graphql/src/service.rs | examples/counter-no-graphql/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::sync::Arc;
use counter_no_graphql::{CounterOperation, CounterRequest};
use linera_sdk::{linera_base_types::WithServiceAbi, views::View, Service, ServiceRuntime};
use self::s... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/native-fungible/src/contract.rs | examples/native-fungible/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
use linera_sdk::{
abis::fungible::{
FungibleOperation, FungibleResponse, FungibleTokenAbi, InitialState, Parameters,
},
linera_base_types::{Account, AccountOwner, ChainId, With... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/native-fungible/src/lib.rs | examples/native-fungible/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! ABI of the Native Fungible Token Example Application */
use async_graphql::SimpleObject;
use linera_sdk::linera_base_types::{AccountOwner, Amount};
use serde::{Deserialize, Serialize};
pub const TICKER_SYMBOL: &str = "NAT";
#[derive(Des... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/native-fungible/src/service.rs | examples/native-fungible/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
use std::sync::Arc;
use async_graphql::{EmptySubscription, Object, Request, Response, Schema};
use fungible::Parameters;
use linera_sdk::{
abis::fungible::{FungibleOperation, FungibleTokenAbi... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/native-fungible/tests/transfers.rs | examples/native-fungible/tests/transfers.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg(not(target_arch = "wasm32"))]
//! Integration tests for Native Fungible Token transfers.
use std::collections::{BTreeMap, HashMap};
use fungible::{self, FungibleTokenAbi};
use linera_sdk::{
linera_base_types::{Account, AccountOwn... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/task-processor/src/contract.rs | examples/task-processor/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use linera_sdk::{
linera_base_types::WithContractAbi,
views::{RootView, View},
Contract, ContractRuntime,
};
use task_processor::{TaskProcessorAbi, TaskProcessorOperation};... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/task-processor/src/lib.rs | examples/task-processor/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! ABI of the Task Processor Example Application.
//!
//! This application demonstrates the off-chain task processor functionality.
//! It requests tasks to be executed by an external "echo" operator and stores
//! the results in its state.
... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/task-processor/src/state.rs | examples/task-processor/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use linera_sdk::views::{linera_views, QueueView, RegisterView, RootView, ViewStorageContext};
use serde::{Deserialize, Serialize};
/// A pending task stored in the application state.
#[derive(Clone, Debug, Serialize, Deserialize, async_graphq... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/task-processor/src/service.rs | examples/task-processor/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::sync::Arc;
use async_graphql::{EmptySubscription, Object, Request, Response, Schema};
use linera_sdk::{
linera_base_types::{Timestamp, WithServiceAbi},
task_processor... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/gen-nft/src/random.rs | examples/gen-nft/src/random.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::sync::{Mutex, OnceLock};
use rand::{rngs::StdRng, Rng, SeedableRng};
static RNG: OnceLock<Mutex<StdRng>> = OnceLock::new();
fn custom_getrandom(buf: &mut [u8]) -> Result<(), getrandom::Error> {
let seed = [0u8; 32];
RNG.get... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/gen-nft/src/contract.rs | examples/gen-nft/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::collections::BTreeSet;
use gen_nft::{GenNftAbi, Message, Nft, Operation, TokenId};
use linera_sdk::{
linera_base_types::{Account, AccountOwner, WithContractAbi},
view... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/gen-nft/src/lib.rs | examples/gen-nft/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! ABI of the Generative NFT Example Application */
use std::fmt::{Display, Formatter};
use async_graphql::{InputObject, Request, Response, SimpleObject};
use linera_sdk::{
linera_base_types::{Account, AccountOwner, ApplicationId, Chain... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/gen-nft/src/state.rs | examples/gen-nft/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::collections::BTreeSet;
use async_graphql::SimpleObject;
use gen_nft::{Nft, TokenId};
use linera_sdk::{
linera_base_types::AccountOwner,
views::{linera_views, MapView, RegisterView, RootView, ViewStorageContext},
};
/// The a... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/gen-nft/src/service.rs | examples/gen-nft/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod model;
mod random;
mod state;
mod token;
use std::{
collections::{BTreeMap, BTreeSet},
sync::Arc,
};
use async_graphql::{Context, EmptySubscription, Object, Request, Response, Schema... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/gen-nft/src/model.rs | examples/gen-nft/src/model.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::io::{Cursor, Seek, SeekFrom};
use candle_core::{
quantized::{ggml_file, gguf_file},
Device, IndexOp, Tensor,
};
use candle_transformers::{
generation::LogitsProcessor,
models::{llama2_c, llama2_c::Llama, llama2_c_weig... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/gen-nft/src/token.rs | examples/gen-nft/src/token.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/// This is taken from https://github.com/huggingface/candle/blob/4fd00b890036ef67391a9cc03f896247d0a75711/candle-examples/src/token_output_stream.rs
use candle_core::Result;
/// This is a wrapper around a tokenizer to ensure that tokens can ... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/hex-game/src/contract.rs | examples/hex-game/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use async_graphql::ComplexObject;
use hex_game::{Board, Clock, HexAbi, HexOutcome, Operation, Timeouts};
use linera_sdk::{
linera_base_types::{
AccountOwner, Amount, Applic... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/hex-game/src/lib.rs | examples/hex-game/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! ABI of the Hex game */
use std::iter;
use async_graphql::{Enum, InputObject, Request, Response, SimpleObject};
use linera_sdk::{
graphql::GraphQLMutationRoot,
linera_base_types::{AccountOwner, Amount, ContractAbi, ServiceAbi, Tim... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/hex-game/src/state.rs | examples/hex-game/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::collections::BTreeSet;
use async_graphql::SimpleObject;
use hex_game::{Board, Clock, Timeouts};
use linera_sdk::{
linera_base_types::{AccountOwner, ChainId},
views::{linera_views, MapView, RegisterView, RootView, ViewStorageC... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/hex-game/src/service.rs | examples/hex-game/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::sync::Arc;
use async_graphql::{ComplexObject, Context, EmptySubscription, Request, Response, Schema};
use hex_game::{Operation, Player};
use linera_sdk::{
graphql::GraphQ... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/hex-game/tests/hex_game.rs | examples/hex-game/tests/hex_game.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Integration tests for the Hex application.
#![cfg(not(target_arch = "wasm32"))]
use hex_game::{HexAbi, Operation, Timeouts};
use linera_sdk::{
linera_base_types::{
AccountSecretKey, Amount, BlobType, ChainDescription, Secp256... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/social/src/contract.rs | examples/social/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use linera_sdk::{
linera_base_types::{ChainId, StreamUpdate, WithContractAbi},
views::{RootView, View},
Contract, ContractRuntime,
};
use serde::{Deserialize, Serialize};
u... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/social/src/lib.rs | examples/social/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! ABI of the Social Media Example Application */
use async_graphql::{InputObject, Request, Response, SimpleObject};
use linera_sdk::{
graphql::GraphQLMutationRoot,
linera_base_types::{ChainId, ContractAbi, ServiceAbi, Timestamp},
... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/social/src/state.rs | examples/social/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use linera_sdk::views::{linera_views, CustomMapView, LogView, RootView, ViewStorageContext};
use social::{Key, OwnPost, Post};
/// The application state.
#[derive(RootView, async_graphql::SimpleObject)]
#[view(context = ViewStorageContext)]
p... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/social/src/service.rs | examples/social/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::sync::Arc;
use async_graphql::{EmptySubscription, Request, Response, Schema};
use linera_sdk::{
graphql::GraphQLMutationRoot as _, linera_base_types::WithServiceAbi, view... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/social/tests/cross_chain.rs | examples/social/tests/cross_chain.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Integration tests for the social network application.
#![cfg(not(target_arch = "wasm32"))]
use linera_sdk::test::{QueryOutcome, TestValidator};
use social::Operation;
/// Test posting messages across microchains.
///
/// Creates the app... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/ethereum-tracker/src/contract.rs | examples/ethereum-tracker/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use alloy_primitives::U256;
use ethereum_tracker::{EthereumTrackerAbi, InstantiationArgument};
use linera_sdk::{
linera_base_types::WithContractAbi,
views::{RootView, View},
... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/ethereum-tracker/src/lib.rs | examples/ethereum-tracker/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*!
A Linera application that reads events emitted by the `simple_token.sol` example from
`linera-ethereum` and tracks the balances. This shows how Wasm contracts on Linera can
consume information generated by EVM contracts on Ethereum.
*/
us... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/ethereum-tracker/src/state.rs | examples/ethereum-tracker/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use ethereum_tracker::U256Cont;
use linera_sdk::views::{linera_views, MapView, RegisterView, RootView, ViewStorageContext};
/// The application state.
#[derive(RootView, async_graphql::SimpleObject)]
#[view(context = ViewStorageContext)]
pub ... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/ethereum-tracker/src/service.rs | examples/ethereum-tracker/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::sync::Arc;
use alloy_primitives::U256;
use async_graphql::{EmptySubscription, Request, Response, Schema};
use ethereum_tracker::Operation;
use linera_sdk::{
ethereum::{Et... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/llm/src/random.rs | examples/llm/src/random.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::sync::{Mutex, OnceLock};
use rand::{rngs::StdRng, Rng, SeedableRng};
static RNG: OnceLock<Mutex<StdRng>> = OnceLock::new();
fn custom_getrandom(buf: &mut [u8]) -> Result<(), getrandom::Error> {
let seed = [0u8; 32];
RNG.get... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/llm/src/contract.rs | examples/llm/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
use linera_sdk::{linera_base_types::WithContractAbi, Contract, ContractRuntime};
pub struct LlmContract;
linera_sdk::contract!(LlmContract);
impl WithContractAbi for LlmContract {
type Abi ... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/llm/src/lib.rs | examples/llm/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! ABI of the LLM Example Application */
use async_graphql::{Request, Response};
use linera_sdk::linera_base_types::{ContractAbi, ServiceAbi};
pub struct LlmAbi;
impl ContractAbi for LlmAbi {
type Operation = ();
type Response = ()... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/llm/src/service.rs | examples/llm/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod random;
mod token;
use std::{
io::{Cursor, Seek, SeekFrom},
sync::Arc,
};
use async_graphql::{Context, EmptyMutation, EmptySubscription, Object, Request, Response, Schema};
use candl... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/llm/src/token.rs | examples/llm/src/token.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/// This is taken from https://github.com/huggingface/candle/blob/4fd00b890036ef67391a9cc03f896247d0a75711/candle-examples/src/token_output_stream.rs
use candle_core::Result;
/// This is a wrapper around a tokenizer to ensure that tokens can ... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/counter/src/contract.rs | examples/counter/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use counter::{CounterAbi, CounterOperation};
use linera_sdk::{
linera_base_types::WithContractAbi,
views::{RootView, View},
Contract, ContractRuntime,
};
use self::state::... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/counter/src/lib.rs | examples/counter/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! ABI of the Counter Example Application */
use async_graphql::{Request, Response};
use linera_sdk::linera_base_types::{ContractAbi, ServiceAbi};
use serde::{Deserialize, Serialize};
pub struct CounterAbi;
#[derive(Debug, Deserialize, Ser... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/counter/src/state.rs | examples/counter/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use linera_sdk::views::{linera_views, RegisterView, RootView, ViewStorageContext};
/// The application state.
#[derive(RootView, async_graphql::SimpleObject)]
#[view(context = ViewStorageContext)]
pub struct CounterState {
pub value: Regi... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/counter/src/service.rs | examples/counter/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::sync::Arc;
use async_graphql::{EmptySubscription, Object, Request, Response, Schema};
use counter::CounterOperation;
use linera_sdk::{linera_base_types::WithServiceAbi, views... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/counter/tests/single_chain.rs | examples/counter/tests/single_chain.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Integration tests for the Counter application.
#![cfg(not(target_arch = "wasm32"))]
use counter::CounterOperation;
use linera_sdk::test::{QueryOutcome, TestValidator};
/// Test setting a counter and testing its coherency across microcha... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/how-to/perform-http-requests/src/test_http_server.rs | examples/how-to/perform-http-requests/src/test_http_server.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! A simple HTTP server binary to use in the README test.
#![cfg_attr(target_arch = "wasm32", no_main)]
#![cfg(not(target_arch = "wasm32"))]
use std::{env, future::IntoFuture as _, net::Ipv4Addr};
use anyhow::anyhow;
use axum::{routing::ge... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/how-to/perform-http-requests/src/contract.rs | examples/how-to/perform-http-requests/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
use how_to_perform_http_requests::{Abi, Operation};
use linera_sdk::{http, linera_base_types::WithContractAbi, Contract as _, ContractRuntime};
pub struct Contract {
runtime: ContractRuntime<... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/how-to/perform-http-requests/src/lib.rs | examples/how-to/perform-http-requests/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! ABI of the Counter Example Application
use async_graphql::{Request, Response};
use linera_sdk::abi::{ContractAbi, ServiceAbi};
use serde::{Deserialize, Serialize};
/// The marker type that connects the types used to interface with the ap... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/how-to/perform-http-requests/src/service.rs | examples/how-to/perform-http-requests/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
use std::sync::Arc;
use async_graphql::{EmptySubscription, Request, Response, Schema};
use how_to_perform_http_requests::{Abi, Operation};
use linera_sdk::{ensure, http, linera_base_types::WithSe... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/how-to/perform-http-requests/src/unit_tests/contract.rs | examples/how-to/perform-http-requests/src/unit_tests/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg(test)]
//! Unit tests for the contract.
use how_to_perform_http_requests::{Abi, Operation};
use linera_sdk::{
http, linera_base_types::ApplicationId, util::BlockingWait as _, Contract as _, ContractRuntime,
};
use super::Contract... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/how-to/perform-http-requests/src/unit_tests/service.rs | examples/how-to/perform-http-requests/src/unit_tests/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg(test)]
//! Unit tests for the service.
use std::sync::Arc;
use assert_matches::assert_matches;
use how_to_perform_http_requests::Operation;
use linera_sdk::{http, util::BlockingWait, Service as _, ServiceRuntime};
use super::Service... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/how-to/perform-http-requests/tests/http_requests.rs | examples/how-to/perform-http-requests/tests/http_requests.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Integration tests that perform real HTTP requests to a local HTTP server.
#![cfg(not(target_arch = "wasm32"))]
use assert_matches::assert_matches;
use axum::{routing::get, Router};
use how_to_perform_http_requests::Abi;
use linera_sdk::t... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/how-to/perform-http-requests/tests/http_server/mod.rs | examples/how-to/perform-http-requests/tests/http_server/mod.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! A simple HTTP server to use for testing.
use std::{future::IntoFuture, net::Ipv4Addr};
use axum::Router;
use futures::FutureExt as _;
use tokio::{net::TcpListener, sync::oneshot};
/// A handle to a running HTTP server.
///
/// The serve... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/agent/src/main.rs | examples/agent/src/main.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::{io, io::Write};
use anyhow::Result;
use clap::Parser;
use reqwest::Client;
use rig::{
agent::AgentBuilder,
completion::{Chat, Message, ToolDefinition},
providers::openai,
tool::Tool,
};
use serde::{Deserialize, Seria... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/call-evm-counter/src/contract.rs | examples/call-evm-counter/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
use alloy_primitives::{address, U256};
use alloy_sol_types::{sol, SolCall};
use call_evm_counter::{CallCounterAbi, CallCounterOperation};
use linera_sdk::{
abis::evm::EvmAbi,
linera_base_t... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/call-evm-counter/src/lib.rs | examples/call-evm-counter/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! ABI of the Counter Example Application that does not use GraphQL */
use linera_sdk::linera_base_types::{ContractAbi, ServiceAbi};
use serde::{Deserialize, Serialize};
pub struct CallCounterAbi;
impl ContractAbi for CallCounterAbi {
... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/call-evm-counter/src/service.rs | examples/call-evm-counter/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
use std::sync::Arc;
use alloy_primitives::{address, U256};
use alloy_sol_types::{sol, SolCall};
use call_evm_counter::{CallCounterOperation, CallCounterRequest};
use linera_sdk::{
abis::evm::... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/matching-engine/src/contract.rs | examples/matching-engine/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use linera_sdk::{
linera_base_types::{Account, AccountOwner, Amount, ChainId, WithContractAbi},
views::{linera_views, RootView, View},
Contract, ContractRuntime,
};
use mat... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/matching-engine/src/lib.rs | examples/matching-engine/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! ABI of the Matching Engine Example Application */
use async_graphql::{scalar, InputObject, Request, Response, SimpleObject};
use fungible::FungibleTokenAbi;
use linera_sdk::{
graphql::GraphQLMutationRoot,
linera_base_types::{Accou... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/matching-engine/src/state.rs | examples/matching-engine/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![allow(dead_code)]
use std::{cmp::min, collections::BTreeSet};
use async_graphql::SimpleObject;
use linera_sdk::{
linera_base_types::{Account, AccountOwner, Amount},
views::{linera_views, linera_views::context::Context as _},
K... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/matching-engine/src/service.rs | examples/matching-engine/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::sync::Arc;
use async_graphql::{EmptySubscription, Request, Response, Schema};
use linera_sdk::{
graphql::GraphQLMutationRoot,
linera_base_types::WithServiceAbi,
v... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/matching-engine/tests/transaction.rs | examples/matching-engine/tests/transaction.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Integration tests for the Matching Engine application
#![cfg(not(target_arch = "wasm32"))]
use async_graphql::InputType;
use linera_sdk::{
linera_base_types::{AccountOwner, Amount, ApplicationId, ApplicationPermissions},
test::{A... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/non-fungible/src/contract.rs | examples/non-fungible/src/contract.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::collections::BTreeSet;
use linera_sdk::{
linera_base_types::{Account, AccountOwner, DataBlobHash, WithContractAbi},
views::{RootView, View},
Contract, ContractRun... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/non-fungible/src/lib.rs | examples/non-fungible/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*! ABI of the Non-Fungible Token Example Application */
use std::fmt::{Display, Formatter};
use async_graphql::{InputObject, Request, Response, SimpleObject};
use linera_sdk::{
linera_base_types::{
Account, AccountOwner, Applica... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/non-fungible/src/state.rs | examples/non-fungible/src/state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::collections::BTreeSet;
use async_graphql::SimpleObject;
use linera_sdk::{
linera_base_types::AccountOwner,
views::{linera_views, MapView, RegisterView, RootView, ViewStorageContext},
};
use non_fungible::{Nft, TokenId};
/// ... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/examples/non-fungible/src/service.rs | examples/non-fungible/src/service.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(target_arch = "wasm32", no_main)]
mod state;
use std::{
collections::{BTreeMap, BTreeSet},
sync::Arc,
};
use async_graphql::{EmptySubscription, Object, Request, Response, Schema};
use base64::engine::{general_purpose::ST... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-persistent/build.rs | linera-persistent/build.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
fn main() {
cfg_aliases::cfg_aliases! {
web: { all(target_arch = "wasm32", feature = "web") },
with_indexed_db: { all(web, feature = "indexed-db") },
};
}
| rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-persistent/src/lib.rs | linera-persistent/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
/*!
This crate handles persisting data types to disk with a variety of backends.
*/
#![allow(async_fn_in_trait)]
cfg_if::cfg_if! {
if #[cfg(with_indexed_db)] {
pub mod indexed_db;
pub use indexed_db::IndexedDb;
}
}
c... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-persistent/src/memory.rs | linera-persistent/src/memory.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use super::Persist;
pub type Error = std::convert::Infallible;
/// A dummy [`Persist`] implementation that doesn't persist anything, but holds the value
/// in memory.
#[derive(Default, derive_more::Deref)]
pub struct Memory<T> {
#[deref... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-persistent/src/file.rs | linera-persistent/src/file.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::{
io::{self, BufRead as _, Write as _},
path::Path,
};
use fs4::FileExt;
use thiserror_context::Context;
use super::Persist;
/// A guard that keeps an exclusive lock on a file.
struct Lock(fs_err::File);
#[derive(Debug, th... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-persistent/src/dirty.rs | linera-persistent/src/dirty.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#[derive(Clone, Debug, Default, PartialEq, Eq, derive_more::Deref, derive_more::DerefMut)]
pub struct Dirty(
#[deref]
#[deref_mut]
bool,
);
impl Dirty {
pub fn new(dirty: bool) -> Self {
Self(dirty)
}
}
impl Drop ... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-persistent/src/indexed_db.rs | linera-persistent/src/indexed_db.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use indexed_db_futures::prelude::*;
use tracing::instrument;
use wasm_bindgen::JsValue;
use wasm_bindgen_futures::wasm_bindgen;
use web_sys::DomException;
use super::{dirty::Dirty, Persist};
/// An implementation of [`Persist`] based on an I... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-sdk-derive/src/lib.rs | linera-sdk-derive/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! The procedural macros for the crate `linera-sdk`.
mod utils;
use proc_macro::TokenStream;
use proc_macro2::{Ident, Span};
use syn::{
parse_macro_input, Fields, ItemEnum,
__private::{quote::quote, TokenStream2},
};
use crate::uti... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-sdk-derive/src/utils.rs | linera-sdk-derive/src/utils.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use convert_case::{Case, Casing};
use proc_macro2::{Ident, Span};
/// Extracts the first `Ident` in a type and convert to snake case.
pub fn snakify(ident: &Ident) -> Ident {
transform_non_keyword_ident(ident, |s: String| s.to_case(Case::... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-faucet/server/build.rs | linera-faucet/server/build.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
fn main() {
cfg_aliases::cfg_aliases! {
with_metrics: { all(not(target_arch = "wasm32"), feature = "metrics") },
};
}
| rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-faucet/server/src/lib.rs | linera-faucet/server/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![recursion_limit = "256"]
//! The server component of the Linera faucet.
mod database;
use std::{collections::VecDeque, future::IntoFuture, net::SocketAddr, path::PathBuf, sync::Arc};
use anyhow::Context as _;
use async_graphql::{EmptySu... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | true |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-faucet/server/src/tests.rs | linera-faucet/server/src/tests.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![allow(clippy::large_futures)]
use std::{collections::VecDeque, sync::Arc};
use futures::lock::Mutex;
use linera_base::{
crypto::{AccountPublicKey, CryptoHash, InMemorySigner, TestString},
data_types::{Amount, Epoch, Timestamp},
... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-faucet/server/src/database.rs | linera-faucet/server/src/database.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! SQLite database module for storing chain assignments.
use std::{collections::BTreeMap, path::PathBuf};
use anyhow::Context as _;
use linera_base::{
crypto::CryptoHash,
data_types::BlockHeight,
identifiers::{AccountOwner, Chai... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-faucet/client/src/lib.rs | linera-faucet/client/src/lib.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! The client component of the Linera faucet.
// TODO(#3362): generate this code
use std::collections::BTreeMap;
use linera_base::{crypto::ValidatorPublicKey, data_types::ChainDescription};
use linera_client::config::GenesisConfig;
use lin... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-witty/build.rs | linera-witty/build.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
fn main() {
cfg_aliases::cfg_aliases! {
with_log: { feature = "log" },
with_testing: { any(test, feature = "test") },
with_wasmer: { feature = "wasmer" },
with_wasmtime: { feature = "wasmtime" },
wit... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-witty/test-modules/src/reentrancy/global_state.rs | linera-witty/test-modules/src/reentrancy/global_state.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Helper Wasm module for reentrancy tests with a global state, to check that it is persisted
//! across reentrant calls.
#![cfg_attr(target_arch = "wasm32", no_main)]
wit_bindgen::generate!("reentrant-global-state");
export_reentrant_glob... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-witty/test-modules/src/reentrancy/operations.rs | linera-witty/test-modules/src/reentrancy/operations.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Helper Wasm module for reentrancy tests with some functions that have multiple parameters and
//! return values.
#![cfg_attr(target_arch = "wasm32", no_main)]
wit_bindgen::generate!("reentrant-operations");
export_reentrant_operations!(... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-witty/test-modules/src/reentrancy/setters.rs | linera-witty/test-modules/src/reentrancy/setters.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Helper Wasm module for reentrancy tests with some functions that have one parameter and no
//! return values.
#![cfg_attr(target_arch = "wasm32", no_main)]
wit_bindgen::generate!("reentrant-setters");
export_reentrant_setters!(Implement... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-witty/test-modules/src/reentrancy/getters.rs | linera-witty/test-modules/src/reentrancy/getters.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Helper Wasm module for reentrancy tests with some functions that return values.
#![cfg_attr(target_arch = "wasm32", no_main)]
wit_bindgen::generate!("reentrant-getters");
export_reentrant_getters!(Implementation);
use self::{
expor... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-witty/test-modules/src/reentrancy/simple_function.rs | linera-witty/test-modules/src/reentrancy/simple_function.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Helper Wasm module for reentrancy tests with a simple function that has no parameters nor
//! returns values.
#![cfg_attr(target_arch = "wasm32", no_main)]
wit_bindgen::generate!("reentrant-simple-function");
export_reentrant_simple_fun... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-witty/test-modules/src/export/operations.rs | linera-witty/test-modules/src/export/operations.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Helper Wasm module with some functions that have two parameters and one return value.
#![cfg_attr(target_arch = "wasm32", no_main)]
wit_bindgen::generate!("export-operations");
export_export_operations!(Implementation);
use self::expor... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-witty/test-modules/src/export/setters.rs | linera-witty/test-modules/src/export/setters.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Helper Wasm module with some functions that have one parameter and no return values.
#![cfg_attr(target_arch = "wasm32", no_main)]
wit_bindgen::generate!("export-setters");
export_export_setters!(Implementation);
use self::exports::wit... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-witty/test-modules/src/export/getters.rs | linera-witty/test-modules/src/export/getters.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Helper Wasm module with some functions that have no parameters but return values.
#![cfg_attr(target_arch = "wasm32", no_main)]
wit_bindgen::generate!("export-getters");
export_export_getters!(Implementation);
use self::exports::witty_... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
linera-io/linera-protocol | https://github.com/linera-io/linera-protocol/blob/69f159d2106f7fc70870ce70074c55850bf1303b/linera-witty/test-modules/src/export/simple_function.rs | linera-witty/test-modules/src/export/simple_function.rs | // Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Helper Wasm module with a minimal function without parameters or return values.
#![cfg_attr(target_arch = "wasm32", no_main)]
wit_bindgen::generate!("export-simple-function");
export_export_simple_function!(Implementation);
use self::e... | rust | Apache-2.0 | 69f159d2106f7fc70870ce70074c55850bf1303b | 2026-01-04T15:33:08.660695Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.