Skip to content

Commit

Permalink
feat: added get_token_id method on NEAR chain
Browse files Browse the repository at this point in the history
  • Loading branch information
frolvanya committed Nov 30, 2024
1 parent d4393e7 commit 113ff69
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,25 @@ impl NearBridgeClient {
Ok(())
}

pub async fn get_token_id(&self, token_address: OmniAddress) -> Result<AccountId> {
let endpoint = self.endpoint()?;
let token_id = self.token_locker_id_as_account_id()?;

let response = near_rpc_client::view(
endpoint,
token_id,
"get_token_id".to_string(),
serde_json::json!({
"address": token_address
}),
)
.await?;

let token_id = serde_json::from_slice::<AccountId>(&response)?;

Ok(token_id)
}

pub async fn extract_transfer_log(
&self,
transaction_hash: CryptoHash,
Expand Down
5 changes: 5 additions & 0 deletions bridge-sdk/connectors/omni-connector/src/omni_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ impl OmniConnector {
.await
}

pub async fn near_get_token_id(&self, token_address: OmniAddress) -> Result<AccountId> {
let near_bridge_client = self.near_bridge_client()?;
near_bridge_client.get_token_id(token_address).await
}

pub async fn init_transfer(&self, init_transfer_args: InitTransferArgs) -> Result<String> {
match init_transfer_args {
InitTransferArgs::NearInitTransfer {
Expand Down

0 comments on commit 113ff69

Please sign in to comment.