Documentation
¶
Index ¶
- type BurnSDByOwnerResult
- type BurnVehicleByOwnerResult
- type Client
- func (c *Client) Close()
- func (c *Client) GetBurnSDByOwnerResult(result *zerodev.UserOperationResult) (*BurnSDByOwnerResult, error)
- func (c *Client) GetBurnSDByOwnerUserOperationAndHash(owner common.Address, syntheticDeviceTokenId *big.Int) (op *zerodev.UserOperation, hash *common.Hash, err error)
- func (c *Client) GetBurnSDTypedData(vehicleNode *big.Int, syntheticDeviceNode *big.Int) *signer.TypedData
- func (c *Client) GetBurnVehicleByOwnerResult(result *zerodev.UserOperationResult) (*BurnVehicleByOwnerResult, error)
- func (c *Client) GetBurnVehicleByOwnerUserOperationAndHash(owner common.Address, vehicleTokenId *big.Int) (op *zerodev.UserOperation, hash *common.Hash, err error)
- func (c *Client) GetMintSDResult(result *zerodev.UserOperationResult) (*MintSDResult, error)
- func (c *Client) GetMintSDTypedData(integrationNode *big.Int, vehicleNode *big.Int) *signer.TypedData
- func (c *Client) GetMintSDTypedDataV2(connectionID *big.Int, vehicleNode *big.Int) *signer.TypedData
- func (c *Client) GetMintVehicleAndSDTypedData(integrationNode *big.Int) *signer.TypedData
- func (c *Client) GetMintVehicleAndSDTypedDataV2(connectionID *big.Int) *signer.TypedData
- func (c *Client) GetMintVehicleAndSDWithDDResult(result *zerodev.UserOperationResult) (*MintVehicleAndSDWithDDResult, error)
- func (c *Client) GetMintVehicleWithDDResult(result *zerodev.UserOperationResult) (*MintVehicleWithDDResult, error)
- func (c *Client) GetMintVehicleWithDDTypedData(manufacturerNode *big.Int, owner common.Address, deviceDefinitionId string, ...) *signer.TypedData
- func (c *Client) GetReceipt(result *zerodev.UserOperationResult) (receipt *zerodev.UserOperationReceipt, err error)
- func (c *Client) GetSafeTransferFromResult(result *zerodev.UserOperationResult) (*SafeTransferFromResult, error)
- func (c *Client) GetSafeTransferFromUserOperationAndHash(from common.Address, to common.Address, tokenId *big.Int) (op *zerodev.UserOperation, hash *common.Hash, err error)
- func (c *Client) GetSetPermissionsResult(result *zerodev.UserOperationResult) (*SetPermissionsResult, error)
- func (c *Client) GetSetPermissionsUserOperationAndHash(owner common.Address, sacdInput registry.SetPermissionsSacdInput) (op *zerodev.UserOperation, hash *common.Hash, err error)
- func (c *Client) MintSD(data *registry.MintSyntheticDeviceInput, waitForReceipt bool, getResult bool) (*zerodev.UserOperationResult, *MintSDResult, error)
- func (c *Client) MintVehicleAndSDWithDD(data *registry.MintVehicleAndSdWithDdInput, waitForReceipt bool, ...) (*zerodev.UserOperationResult, *MintVehicleAndSDWithDDResult, error)
- func (c *Client) MintVehicleAndSDWithDDAndSACD(data *registry.MintVehicleAndSdWithDdInput, sacdInput registry.SacdInput, ...) (*zerodev.UserOperationResult, *MintVehicleAndSDWithDDResult, error)
- func (c *Client) MintVehicleAndSDWithDDBatch(data []registry.MintVehicleAndSdWithDdInputBatch, waitForReceipt bool, ...) (*zerodev.UserOperationResult, error)
- func (c *Client) MintVehicleWithDD(data *registry.MintVehicleWithDeviceDefinition, waitForReceipt bool, ...) (*zerodev.UserOperationResult, *MintVehicleWithDDResult, error)
- func (c *Client) SendSignedUserOperation(op *zerodev.UserOperation, waitForReceipt bool) (result *zerodev.UserOperationResult, err error)
- type ClientConfig
- type MintSDResult
- type MintVehicleAndSDWithDDResult
- type MintVehicleWithDDResult
- type SafeTransferFromResult
- type SetPermissionsResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BurnSDByOwnerResult ¶ added in v0.3.0
type BurnSDByOwnerResult struct {
registry.RegistrySyntheticDeviceNodeBurned
}
type BurnVehicleByOwnerResult ¶ added in v0.3.0
type BurnVehicleByOwnerResult struct {
registry.RegistryVehicleNodeBurned
}
type Client ¶
type Client struct {
RegistryAddress common.Address
VehicleIdAddress common.Address
SyntheticDeviceIdAddress common.Address
Registry *registry.Registry
SacdRegistry *sacd.Sacd
VehicleId *vehicleid.Vehicleid
SyntheticDeviceId *sdid.Sdid
ZerodevClient *zerodev.Client
Config ClientConfig
SacdAddress common.Address
// ZerodevSigner is used in cases where eg. backend is doing the payload signing with an AA account. Used in Oracle where oracle owns the vehicles, so we sign mint payload
ZerodevSigner *account.SmartAccountPrivateKeySigner
}
func NewClient ¶
func NewClient(config *ClientConfig) (*Client, error)
func (*Client) GetBurnSDByOwnerResult ¶ added in v0.3.0
func (c *Client) GetBurnSDByOwnerResult(result *zerodev.UserOperationResult) (*BurnSDByOwnerResult, error)
func (*Client) GetBurnSDByOwnerUserOperationAndHash ¶ added in v0.3.0
func (*Client) GetBurnSDTypedData ¶ added in v0.3.0
func (c *Client) GetBurnSDTypedData(vehicleNode *big.Int, syntheticDeviceNode *big.Int) *signer.TypedData
GetBurnSDTypedData generates TypedData for signing by Vehicle owner whenever SD is being burned
func (*Client) GetBurnVehicleByOwnerResult ¶ added in v0.3.0
func (c *Client) GetBurnVehicleByOwnerResult(result *zerodev.UserOperationResult) (*BurnVehicleByOwnerResult, error)
func (*Client) GetBurnVehicleByOwnerUserOperationAndHash ¶
func (*Client) GetMintSDResult ¶ added in v0.3.1
func (c *Client) GetMintSDResult(result *zerodev.UserOperationResult) (*MintSDResult, error)
func (*Client) GetMintSDTypedData ¶ added in v0.3.1
func (c *Client) GetMintSDTypedData(integrationNode *big.Int, vehicleNode *big.Int) *signer.TypedData
GetMintSDTypedData generates TypedData for signing by Vehicle owner whenever a Synthetic Device for this vehicle is minted
func (*Client) GetMintSDTypedDataV2 ¶ added in v0.3.4
func (c *Client) GetMintSDTypedDataV2(connectionID *big.Int, vehicleNode *big.Int) *signer.TypedData
GetMintSDTypedDataV2 generates TypedData for signing by Vehicle owner whenever a Synthetic Device for this vehicle is minted (V2 is using connectionId instead of integration node)
func (*Client) GetMintVehicleAndSDTypedData ¶ added in v0.3.0
GetMintVehicleAndSDTypedData generates TypedData for signing by Synthetic Device (SD) whenever Vehicle with SD is minted
func (*Client) GetMintVehicleAndSDTypedDataV2 ¶ added in v0.3.4
GetMintVehicleAndSDTypedDataV2 generates TypedData for signing by Synthetic Device (SD) whenever Vehicle with SD is minted (V2 is using connectionId instead of integration node)
func (*Client) GetMintVehicleAndSDWithDDResult ¶ added in v0.3.0
func (c *Client) GetMintVehicleAndSDWithDDResult(result *zerodev.UserOperationResult) (*MintVehicleAndSDWithDDResult, error)
func (*Client) GetMintVehicleWithDDResult ¶ added in v0.3.0
func (c *Client) GetMintVehicleWithDDResult(result *zerodev.UserOperationResult) (*MintVehicleWithDDResult, error)
func (*Client) GetMintVehicleWithDDTypedData ¶ added in v0.3.0
func (c *Client) GetMintVehicleWithDDTypedData(manufacturerNode *big.Int, owner common.Address, deviceDefinitionId string, attributeInfoPairs []registry.AttributeInfoPair) *signer.TypedData
GetMintVehicleWithDDTypedData generates TypedData for signing by Vehicle owner whenever Vehicle with Device Definition is minted
func (*Client) GetReceipt ¶ added in v0.3.0
func (c *Client) GetReceipt(result *zerodev.UserOperationResult) (receipt *zerodev.UserOperationReceipt, err error)
func (*Client) GetSafeTransferFromResult ¶ added in v0.3.8
func (c *Client) GetSafeTransferFromResult(result *zerodev.UserOperationResult) (*SafeTransferFromResult, error)
GetSafeTransferFromResult used to interpret the result after submitting the transaction for SafeTransferFromUserOperationAndHash
func (*Client) GetSafeTransferFromUserOperationAndHash ¶ added in v0.3.8
func (c *Client) GetSafeTransferFromUserOperationAndHash(from common.Address, to common.Address, tokenId *big.Int) (op *zerodev.UserOperation, hash *common.Hash, err error)
GetSafeTransferFromUserOperationAndHash gets the data to be signed by the owner (from address) to transfer a vehicle tokenId to another address (to address)
func (*Client) GetSetPermissionsResult ¶ added in v0.5.0
func (c *Client) GetSetPermissionsResult(result *zerodev.UserOperationResult) (*SetPermissionsResult, error)
GetSetPermissionsResult extracts the PermissionsSet event from a completed SetPermissions transaction receipt.
func (*Client) GetSetPermissionsUserOperationAndHash ¶ added in v0.5.0
func (c *Client) GetSetPermissionsUserOperationAndHash(owner common.Address, sacdInput registry.SetPermissionsSacdInput) (op *zerodev.UserOperation, hash *common.Hash, err error)
GetSetPermissionsUserOperationAndHash generates a UserOperation and hash for the vehicle owner to sign, to grant or revoke permissions on a vehicle token via the SACD contract. This follows the same two-step signature flow as vehicle transfer and burn operations: 1. Call this method to get the UserOperation and hash 2. Have the vehicle owner sign the hash 3. Submit via SendSignedUserOperation
Parameters:
- owner: the address of the vehicle token owner who must sign the operation
- sacdInput: contains the permission details:
- VehicleTokenId: the token ID of the vehicle to set permissions on
- Grantee: the address being granted (or revoked) permissions
- Permissions: a bitmask representing the set of permissions to grant
- Expiration: unix timestamp after which the permissions expire
- Source: a URI string identifying the source/context of the permission grant
The asset parameter (ERC721 contract address) is automatically set to the configured VehicleIdAddress.
func (*Client) MintSD ¶ added in v0.3.1
func (c *Client) MintSD(data *registry.MintSyntheticDeviceInput, waitForReceipt bool, getResult bool) (*zerodev.UserOperationResult, *MintSDResult, error)
func (*Client) MintVehicleAndSDWithDD ¶ added in v0.3.0
func (c *Client) MintVehicleAndSDWithDD(data *registry.MintVehicleAndSdWithDdInput, waitForReceipt bool, getResult bool) (*zerodev.UserOperationResult, *MintVehicleAndSDWithDDResult, error)
MintVehicleAndSDWithDD mints a vehicle and paired synthetic device using data with a device definition. No SACD input is required. Requires SD signature of typed data returned by GetMintVehicleAndSDTypedData Requires Vehicle Owner signature of typed data returned by GetMintVehicleWithDDTypedData
func (*Client) MintVehicleAndSDWithDDAndSACD ¶ added in v0.3.0
func (c *Client) MintVehicleAndSDWithDDAndSACD(data *registry.MintVehicleAndSdWithDdInput, sacdInput registry.SacdInput, waitForReceipt bool, getResult bool) (*zerodev.UserOperationResult, *MintVehicleAndSDWithDDResult, error)
MintVehicleAndSDWithDDAndSACD mints a vehicle and paired synthetic device using data with a device definition and separate SACD. Requires SD signature of typed data returned by GetMintVehicleAndSDTypedData Requires Vehicle Owner signature of typed data returned by GetMintVehicleWithDDTypedData
func (*Client) MintVehicleAndSDWithDDBatch ¶ added in v0.3.0
func (c *Client) MintVehicleAndSDWithDDBatch(data []registry.MintVehicleAndSdWithDdInputBatch, waitForReceipt bool, getResult bool) (*zerodev.UserOperationResult, error)
MintVehicleAndSDWithDDBatch mints vehicles and paired synthetic devices in batches using data with a device definition and SACD input. Requires SD signature of typed data returned by GetMintVehicleAndSDTypedData Requires Vehicle Owner signature of typed data returned by GetMintVehicleWithDDTypedData
func (*Client) MintVehicleWithDD ¶ added in v0.3.0
func (c *Client) MintVehicleWithDD(data *registry.MintVehicleWithDeviceDefinition, waitForReceipt bool, getResult bool) (*zerodev.UserOperationResult, *MintVehicleWithDDResult, error)
func (*Client) SendSignedUserOperation ¶
func (c *Client) SendSignedUserOperation(op *zerodev.UserOperation, waitForReceipt bool) (result *zerodev.UserOperationResult, err error)
type ClientConfig ¶
type ClientConfig struct {
AccountAddress common.Address
AccountPK *ecdsa.PrivateKey
RpcURL *url.URL
PaymasterURL *url.URL
BundlerURL *url.URL
ChainID *big.Int
RegistryAddress common.Address
VehicleIdAddress common.Address
SyntheticDeviceIdAddress common.Address
// contract address for sacd, eg in polygon prod: 0x3c152B5d96769661008Ff404224d6530FCAC766d
SacdAddress common.Address
ReceiptPollingDelaySeconds int
ReceiptPollingRetries int
}
type MintSDResult ¶ added in v0.3.1
type MintSDResult struct {
registry.RegistrySyntheticDeviceNodeMinted
}
type MintVehicleAndSDWithDDResult ¶ added in v0.3.0
type MintVehicleAndSDWithDDResult struct {
registry.RegistryVehicleNodeMintedWithDeviceDefinition
registry.RegistrySyntheticDeviceNodeMinted
}
type MintVehicleWithDDResult ¶ added in v0.3.0
type MintVehicleWithDDResult struct {
registry.RegistryVehicleNodeMintedWithDeviceDefinition
}
type SafeTransferFromResult ¶ added in v0.3.8
type SafeTransferFromResult struct {
vehicleid.VehicleidTransfer
}
SafeTransferFromResult used to represnet the vehicle transfer event when we call GetSafeTransferFromResult
type SetPermissionsResult ¶ added in v0.5.0
type SetPermissionsResult struct {
sacd.SacdPermissionsSet
}
SetPermissionsResult represents the PermissionsSet event emitted after a successful SetPermissions transaction.