Skip to content

Commit

Permalink
IOS-7967 Fix parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
amuraveinik committed Oct 9, 2024
1 parent 40d75e3 commit 9b8b3da
Show file tree
Hide file tree
Showing 14 changed files with 1,107 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ class PolkadotTransactionBuilder {
https://github.com/paritytech/polkadot/blob/3b68869e14f84b043aa65bd83f9fe44359e4d626/runtime/kusama/src/lib.rs#L1375
Westend:
https://github.com/paritytech/polkadot/blob/3b68869e14f84b043aa65bd83f9fe44359e4d626/runtime/westend/src/lib.rs#L982
For other chains use experimentally obtained values, or try running the script in the PolkaParachainMetadataParser folder
*/
private var balanceTransferCallIndex: Data {
switch network {
case .polkadot, .azero, .joystream, .bittensor, .energyWebX: // TODO: [Energy Web X] Questionable
case .polkadot, .azero, .joystream, .bittensor:
return Data(hexString: "0x0500")
case .kusama:
return Data(hexString: "0x0400")
case .westend:
return Data(hexString: "0x0400")
case .energyWebX:
return Data(hexString: "0x0a07")
}
}

Expand Down Expand Up @@ -120,13 +124,14 @@ class PolkadotTransactionBuilder {
return call
}

// Use experimentally obtained values
private func encodingRawAddress(specVersion: UInt32) -> Bool {
switch network {
case .polkadot:
return specVersion < 28
case .kusama:
return specVersion < 2028
case .westend, .azero, .bittensor, .energyWebX: // TODO: [Energy Web X] Questionable
case .westend, .azero, .bittensor, .energyWebX:
return false
case .joystream:
// specVersion at the moment of initial implementation is '2003'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct SubstrateRuntimeVersionProvider {
self.network = network
}

// Use experimentally obtained values, or try running the script in the PolkaParachainMetadataParser folder.
func runtimeVersion(for meta: PolkadotBlockchainMeta) -> SubstrateRuntimeVersion {
switch network {
case .polkadot,
Expand All @@ -27,7 +28,7 @@ struct SubstrateRuntimeVersionProvider {
return meta.specVersion >= 198 ? .v15 : .v14
case .azero,
.joystream,
.energyWebX: // TODO: [Energy Web X] Questionable
.energyWebX:
return .v14
}
}
Expand Down
3 changes: 2 additions & 1 deletion BlockchainSdk/Common/Blockchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ public indirect enum Blockchain: Equatable, Hashable {
.blast,
.filecoin,
.energyWebEVM,
.energyWebX,
.core:
return 18
case .cardano,
Expand All @@ -302,7 +303,7 @@ public indirect enum Blockchain: Equatable, Hashable {
return 6
case .stellar:
return 7
case .solana, .ton, .bittensor, .sui, .energyWebX:
case .solana, .ton, .bittensor, .sui:
return 9
case .polkadot(_, let testnet):
return testnet ? 12 : 10
Expand Down
4 changes: 2 additions & 2 deletions BlockchainSdkExample/BlockchainSdkExampleViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import TangemSdk

class BlockchainSdkExampleViewModel: ObservableObject {
@Published var cardWallets: [Card.Wallet] = []
@Published var destination: String = ""
@Published var amountToSend: String = ""
@Published var destination: String = "5F92xKdkVC6qVxWS4QiHN5SrphiAnCv2eeuBQRWs7izPHJ7V"
@Published var amountToSend: String = "1"
@Published var feeDescriptions: [String] = []
@Published var transactionResult: String = "--"
@Published var blockchains: [(String, String)] = []
Expand Down
1 change: 1 addition & 0 deletions PolkaParachainMetadataParser/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
5 changes: 5 additions & 0 deletions PolkaParachainMetadataParser/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions PolkaParachainMetadataParser/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions PolkaParachainMetadataParser/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions PolkaParachainMetadataParser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# WebSocket Chain Metadata Fetcher

This script connects to a blockchain WebSocket endpoint (e.g., Energy Web X) using the Polkadot API and fetches metadata information, including details about the `Balances` pallet and its `transfer` call.

## Prerequisites

- **Node.js**: You need to have Node.js installed on your system. If Node.js is not installed, you can install it using Homebrew:

```bash
brew install node
```

## Usage

1. Make the wrapper script executable:

```bash
chmod +x parse
```

2. Run the script with the WebSocket URL as an argument:

```bash
./parse <url>
```

### Example

To fetch metadata from the Energy Web X network, run the script like this:

```bash
./parse wss://wnp-rpc.mainnet.energywebx.com
Loading

0 comments on commit 9b8b3da

Please sign in to comment.