Skip to content

Commit

Permalink
feat: signer-types (#21)
Browse files Browse the repository at this point in the history
added signer types
  • Loading branch information
EdsonAlcala authored Jan 6, 2025
1 parent e74a470 commit 48a5d56
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "omni-transaction"
version = "0.1.2"
version = "0.1.3"
authors = ["Proximity Labs Limited"]
license = "Apache-2.0"
edition = "2021"
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ pub mod evm;
pub mod near;

pub mod constants;
pub mod signer;
pub mod transaction_builder;
pub mod types;
1 change: 1 addition & 0 deletions src/signer/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod types;
39 changes: 39 additions & 0 deletions src/signer/types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use near_sdk::ext_contract;
use near_sdk::serde::{Deserialize, Serialize};
use near_sdk::NearToken;
use schemars::JsonSchema;

#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
#[serde(crate = "near_sdk::serde")]
pub struct SignatureResponse {
pub big_r: SerializableAffinePoint,
pub s: SerializableScalar,
pub recovery_id: u8,
}

#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
#[serde(crate = "near_sdk::serde")]
pub struct SerializableAffinePoint {
pub affine_point: String,
}

#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
#[serde(crate = "near_sdk::serde")]
pub struct SerializableScalar {
pub scalar: String,
}

#[derive(Debug, Serialize)]
#[serde(crate = "near_sdk::serde")]
pub struct SignRequest {
pub payload: [u8; 32],
pub path: String,
pub key_version: u32,
}

#[allow(dead_code)]
#[ext_contract(mpc_contract)]
pub trait MPCContract {
fn sign(&self, request: SignRequest);
fn experimental_signature_deposit(&self) -> NearToken;
}

0 comments on commit 48a5d56

Please sign in to comment.