Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion docs/README.rfq.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TEST_NETWORK = "https://fullnode.mainnet.sui.io:443"
# Initialize SuiWallet using seed
wallet = SuiWallet(seed=TEST_ACCT_PHRASE)

# Read the contracts config (you can also specify filepath as an argument to read_json, by default it looks for contracts.json at root of working directory )
# Read the contracts config (you can also specify filepath as an argument to read_json, by default it looks for rfq-contracts.json at root of working directory )
contracts_config = read_json()

# Initialize RFQContracts instance using the contract conffigs
Expand Down Expand Up @@ -120,6 +120,13 @@ rfq_client.withdraw_from_vault(
)
```

### Creating a new Vault
```python
rfq_client.create_vault(
manager="0x40923d059eae6ccbbb91ac9442b80b9bec8262122a5756d96021e34cf33f0b1d",
)
```

## API Reference

#### `RFQClient(wallet: SuiWallet, url: str, rfq_contracts: RFQContracts)`
Expand Down Expand Up @@ -152,6 +159,9 @@ Deposits a token amount into the vault.
#### `withdraw_from_vault(vault: str, amount: str, token_type: str) -> Tuple[bool, dict]`
Withdraws a token amount from the vault (only vault manager can withdraw).

#### `def create_vault(self, manager: str ) -> tuple[bool, dict]`
Creates a new vault on bluefin rfq protocol with provided vault manager.


## Contact
For issues and inquiries, please open a GitHub issue.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "bluefin_v2_client_sui"
version = "1.1.2"
version = "1.1.3"
description = "Library to interact with Bluefin exchange protocol including its off-chain api-gateway and on-chain contracts"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
File renamed without changes.
42 changes: 40 additions & 2 deletions src/bluefin_rfq_client/rfq.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def deposit_in_vault(self,
function_library='gateway',
userAddress=self.wallet.getUserAddress(),
packageId=self.rfq_contracts.get_package(),
gasBudget=1000000000,
gasBudget=100000000,
typeArguments=move_function_type_arguments
)

Expand Down Expand Up @@ -235,7 +235,7 @@ def withdraw_from_vault(self,
function_library='gateway',
userAddress=self.wallet.getUserAddress(),
packageId=self.rfq_contracts.get_package(),
gasBudget=1000000000,
gasBudget=100000000,
typeArguments=move_function_type_arguments
)

Expand All @@ -246,4 +246,42 @@ def withdraw_from_vault(self,
return success, res
except Exception as e:
return False , res

def create_vault(self,
manager: str
) -> tuple[bool, dict] :
"""
Creates new vault on bluefin RFQ protocol with provided vault manager

Parameters:
manager (str): address of the account that needs to be manager of vault.

Returns:
Tuple of bool (indicating status of execution) and sui chain response (dict).
"""

move_function_params = [
self.rfq_contracts.get_protocol_config(),
manager
]

tx_bytes = rpc_unsafe_moveCall(
url=self.url,
params=move_function_params,
function_name='create_rfq_vault',
function_library='gateway',
userAddress=self.wallet.getUserAddress(),
packageId=self.rfq_contracts.get_package(),
gasBudget=100000000,
typeArguments=[]
)

signature = self.signer.sign_tx(tx_bytes, self.wallet)
res = rpc_sui_executeTransactionBlock(self.url, tx_bytes, signature)
try:
success = res["result"]["effects"]["status"]["status"] == "success"
return success, res
except Exception as e:
return False , res


2 changes: 1 addition & 1 deletion src/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ async def main():
if __name__ == "__main__":
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
loop.close()
loop.close()
6 changes: 4 additions & 2 deletions src/sui_utils/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ def rpc_unsafe_moveCall(

headers = {"Content-Type": "application/json"}
response = requests.request("POST", url, headers=headers, data=payload)
result = json.loads(response.text)
return result["result"]["txBytes"]
responseJson = json.loads(response.text)
if "result" not in responseJson or "txBytes" not in responseJson["result"] :
raise (Exception(f"Failed to create transaction bytes due to: {responseJson}"))
return responseJson["result"]["txBytes"]


def rpc_sui_executeTransactionBlock(url, txBytes, signature, maxRetries=5):
Expand Down
2 changes: 1 addition & 1 deletion src/sui_utils/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def decimal_to_bcs(self, num):
def read_json(file_path: str = None):
try:
if file_path is None:
file_path = './contracts.json'
file_path = './rfq-contracts.json'
with open(file_path, 'r') as file:
data = json.load(file)
return data
Expand Down
Loading