debyl/starknetphp

PHP that allows you to interact with StarkNet L2 network

dev-main 2024-02-21 07:54 UTC

This package is auto-updated.

Last update: 2024-04-12 12:54:45 UTC


README

starkwarephp allows you to interact with PHP application for StarkEx needs

starkware License

This project is a work-in-progress. Code and documentation are currently under development and are subject to change

Install

Requires PHP 8.0+

Install starkwarephp via the Composer package manager:

composer require debyl/starkwarephp

Usage

Test data from starkex-resources

The following code can be used with a public and private key to get signatures from Limit Order:

$party_a_order = [
    'vaultIdSell' => 21,
    'vaultIdBuy' => 27,
    'amountSell' => '2154686749748910716',
    'amountBuy' => '1470242115489520459',
    'tokenSell' => '0x5fa3383597691ea9d827a79e1a4f0f7989c35ced18ca9619de8ab97e661020',
    'tokenBuy' => '0x774961c824a3b0fb3d2965f01471c9c7734bf8dbde659e0c08dca2ef18d56a',
    'nonce' => 0,
    'expirationTimestamp' => 438953
];
$privateKey = '0x3c1e9550e66958296d11b60f8e8e7a7ad990d07fa65d5f7652c4a6c87d4e3cc'; // change with your private key
$publicKey  = '0x77a3b314db07c45076d11f62b6f9e748a39790441823307743cf00d6597ea43'; // change with your public key
$party_a = new Starknet($privateKey, $publicKey);
print_r($party_a->signLimitOrder( $party_a_order ));

The following code can be used with a public and private key to get message hash from Limit Order:

$party_a_order = [
    'vaultIdSell' => 21,
    'vaultIdBuy' => 27,
    'amountSell' => '2154686749748910716',
    'amountBuy' => '1470242115489520459',
    'tokenSell' => '0x5fa3383597691ea9d827a79e1a4f0f7989c35ced18ca9619de8ab97e661020',
    'tokenBuy' => '0x774961c824a3b0fb3d2965f01471c9c7734bf8dbde659e0c08dca2ef18d56a',
    'nonce' => 0,
    'expirationTimestamp' => 438953
];
$privateKey = '0x3c1e9550e66958296d11b60f8e8e7a7ad990d07fa65d5f7652c4a6c87d4e3cc'; // change with your private key
$publicKey  = '0x77a3b314db07c45076d11f62b6f9e748a39790441823307743cf00d6597ea43'; // change with your public key
$party_a = new Starknet($privateKey, $publicKey);
print $party_a->hashLimitOrder( $party_a_order );

Security

If you discover any security related issues, please email cryptodebyl@gmail.com instead of using the issue tracker.

Credits

  • [Crypto Debyl]

License

The MIT License (MIT). Please see License File for more information.

https://github.com/debyl